Android Question IME Event Fail

Discussion in 'Android Questions' started by jaraiza, Feb 26, 2015.

  1. jaraiza

    jaraiza Active Member Licensed User


    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):

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

    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?
  2. jaraiza

    jaraiza Active Member Licensed User

    Well... I don't know what happened, the problem was
    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 :/
  3. jaraiza

    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:
  4. Erel

    Erel Administrator Staff Member Licensed User

    Have you added the adjustResize attribute to the relevant activity?
  5. jaraiza

    jaraiza Active Member Licensed User

    Mmm.. Nop, something like this?

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

    All my Activities are set to
    #FullScreen: False
    #IncludeTitle: False
  6. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Change main with the name of the activity (if it is not the main activity).
  7. jaraiza

    jaraiza Active Member Licensed User

    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 :)
  8. Erel

    Erel Administrator Staff 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.
  9. jaraiza

    jaraiza Active Member Licensed User


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

    Thanks a lot!!

    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.

  10. Erel

    Erel Administrator Staff Member Licensed User

    You will need to track the current focused EditText with the FocusChanged event.
    jaraiza likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice