BlackBerry soft keyboard listener with OS 4.5 compatible (or later) code

I am developing an application that should work on devices running OS 4.5 or later. In my application, I need to know when the virtual keyboard is visible or invisible. Because, if the virtual keyboard is visible, the text area that the user must enter is located behind the keyboard. If I could determine the moment when the status of the virtual keyboards changed, I could refresh the screen and move the upper area of ​​the text area.

Is there any way to do this?

Edit: the next button is in the status bar. The edit field is located in the user’s horizontal field manager.

enter image description here

, .

enter image description here

+3
5

. . 4,5 - 4,7. - 4.7 .

4.7 ( ) , , . , .

+2

. :

  • , , . , . , .
    , "" .

  • , , VirtualKeyboard OS 4.7+, BlackBerry. 4 : BlackBerry.

+2

, . ,

    if(VirtualKeyboard.isSupported() == true){
        VirtualKeyboard keyboard = getVirtualKeyboard();

        if(keyboard != null)
            keyboard.setVisibility(VirtualKeyboard.HIDE);
    }
+1

. , API . - setLayout() , . .

+1

VERTICAL_SCROLL , EditField, VERTICAL_SCROLL. EditField .

, , :

class FocusableManager extends MainScreen implements FocusChangeListener
{
    private BasicEditField b;
    public FocusableManager() 
    {
        VerticalFieldManager vfm=new VerticalFieldManager(VERTICAL_SCROLL);
        vfm.add(new ButtonField("first"));
        b=new BasicEditField();
        b.setFocusListener(this);
        vfm.add(b);
        vfm.add(new ButtonField("second"));
        vfm.setMargin(250,0,0,0);
        add(vfm);
    }
    public void focusChanged(Field field, int eventType)
    {
        if(field==b)
        {
            if(eventType==1)//when edit field gain focus
            {
                VirtualKeyboard virtKbd;
                virtKbd =  getScreen().getVirtualKeyboard();
                virtKbd.setVisibility(VirtualKeyboard.SHOW_FORCE);
            }
            else if(eventType==3)//when edit field lost focus
            {
                VirtualKeyboard virtKbd;
                virtKbd =  getScreen().getVirtualKeyboard();
                virtKbd.setVisibility(VirtualKeyboard.HIDE_FORCE);
            }
        }
    }
}
0
source

All Articles