Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Shinji
Posts: 6
Registered: ‎06-30-2011
My Device: None.
Accepted Solution

Detect if slider is open/close on 5.0

Hi,

 

For some reason I need to manually display/hide the virtual keyboard. This was going well until I tried to determine if the device slider is open/close as there is no need to display the virtual keyboard if the slider is open.

 

I found a way to do this using Sensor.SLIDE starting from OS 6.0, but Is there a way to check the slider status on OS 5.0 ?

 

Thanks.

Please use plain text.
Developer
tklanilkumar
Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800

Re: Detect if slider is open/close on 5.0

// if you want to show the keyboard

if(Touchscreen.isSupported())
{
VirtualKeyboard vkb=UiApplication.getUiApplication().getActiveScreen().getVirtualKeyboard();
vkb.setVisibility(VirtualKeyboard.SHOW);
}

// for hiding

if(Touchscreen.isSupported())
{
VirtualKeyboard vkb=UiApplication.getUiApplication().getActiveScreen().getVirtualKeyboard();
vkb.setVisibility(VirtualKeyboard.HIDE);
}

feel free to gice kudos if it helps you
*****************************************************************************
* Give kudos when you like it
* Mark it as a solution if it fixes your issue
Please use plain text.
New Developer
Shinji
Posts: 6
Registered: ‎06-30-2011
My Device: None.

Re: Detect if slider is open/close on 5.0

Thanks for your answer, but I already figured that out. What I would like to know is if the device slider is open or close because if I try to display the virtual keyboard and the slider is open, then the virtual keyboard is not displayed, but I'm still making modifications to my layout so it looks fine on half the screen.

Please use plain text.
New Developer
Shinji
Posts: 6
Registered: ‎06-30-2011
My Device: None.

Re: Detect if slider is open/close on 5.0

Ok, nevermind, just have to check if keyboard.getVisibility() != VirtualKeyboard.HIDE after trying to display it...

Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook

Re: Detect if slider is open/close on 5.0

Another way you could find this out is to get the hardware layout value from the keypad class. If it shows as the virtual keyboard then the slider is open, otherwise it is closed.

Please use plain text.