Android Question IME Event Fail

jaraiza

Active Member
Licensed User
Hi,

Is there any way the event can fail? I mean, any suggestion to follow when the event is never called?

I put this code in a clean project (The layout contains an EditText view):

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Test")

    MyIME.Initialize("NewIME")
    MyIME.AddHeightChangedEvent
   
End Sub

Sub NewIME_HeightChanged(NewHeight As Int, OldHeight As Int)
    Dim Dummy As String
End Sub

This code works fine, as soon as I click the EditText and the keyboard appears, the event is triggered.

But when I try to implement this in a big project I've done before, the event doesn't work with any EditText view :(

I've loaded the same Libs and copied Manifiest contents just in case so I can be sure isn't any kind of incompatibility.

Any ideas?
Thanks!
 

jaraiza

Active Member
Licensed User
Well... I don't know what happened, the problem was
B4X:
MyIME.AddHeightChangedEvent
It wasn't adding the event to MyIME. I keep deleting the line, moving code up and down (not changing sections), reinserted the line some times and suddenly it began to work... Crazy :/
 

jaraiza

Active Member
Licensed User
Ok, I'm getting crazy.

The default Activity (Main) is my login page. If I put a jump to Main System Activity -StartActivity("AppScreen")- from Globals section, the IME Event works fine.

If I go through all the user/password validation and then jump to Main System Activity, the IME Event doesn't work.

AARRGHHHH :eek::eek:
 

jaraiza

Active Member
Licensed User
Have you added the adjustResize attribute to the relevant activity?
Mmm.. Nop, something like this?

SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

P.S.
All my Activities are set to
#FullScreen: False
#IncludeTitle: False
 

jaraiza

Active Member
Licensed User
Yes. Change main with the name of the activity (if it is not the main activity).
Yeah, that works :)

But I've some doubts... The phone I'm testing in is a Samsung Galaxy Note 1, and this phone automatically moves all the screen up when you select an EditText View. I was expecting to add the event with an option to let the user select if they want to implement this fix or leave the phone do the job (when it supports the auto-move)

But when I added your fix, even my phone needs objects to be "manually" set.

Is there anyway to implement this, or is an "all or nothing" solution?

Thanks a lot :)
 

jaraiza

Active Member
Licensed User
You can either use the adjustResize mode and handle the HeightChanged event or use adjustPan mode which lets the OS handle it for you. It is not a feature specific to Galaxy Note.
O...M...G...

I've lost all day trying this to work. ONE LINE and all worked like the Galaxy Note... :eek:

Thanks a lot!!

P.S.
Just to let this topic finished...

Is there any way to clear the added event? I only needed two editboxes to go up when the keyboard, but when I pressed a third editbox the first two went up again. The HeightChanged event doesn't have a "sender" like property to let me know which editbox was pressed.

Greets!
 
Top