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
Contributor
EricTheRed03
Posts: 32
Registered: ‎08-13-2012
My Device: 9800
Accepted Solution

VirtualKeyboard Stuck

[ Edited ]

Hi,

 

I have a blackberry edit: Torch (roll out keyboard). So when I click a labelField with the hardware keyboard closed the virtual keyboard comes up. Great!

 

Now for the problem.. the keyboard (in my app) does not leave the screen even when I click another Field Manager on my MainScreen.

 

I've found the ability to capture these touch events through overriding 'touchEvent(TouchEvent message)' but I didn't find anywhere in the documetation telling me that I had to overide this method to hide the VirtualKeyboard at any point. Isn't there an automatic mode which detects where I am clicking on the mainscren and shows or hides the virtual keyboard accordingly?

 

Is there any obvious information that I am missing here? 

Developer
shahumang8
Posts: 671
Registered: ‎08-09-2010
My Device: Not Specified

Re: VirtualKeyboard Stuck

Hello,

 

 Try this code.

if (getVirtualKeyboard().getVisibility() == 1) {
	getVirtualKeyboard().setVisibility(VirtualKeyboard.HIDE);
}

 

Put this code as per your requirement.

 

E.g. If i click button and after push another page at that time VirtualKeyboard hide automatically then i put this code into Click Event.

 

---------------------------------------------------------------------------------------------------------------------------------------

 

feel free to press the like button on the right side to thank the user that helped you.

Contributor
EricTheRed03
Posts: 32
Registered: ‎08-13-2012
My Device: 9800

Re: VirtualKeyboard Stuck

[ Edited ]

Thanks for a reply. I guess it can be simple. But I still wonder why I have to manually check the VKeyboard only on one of my screens. Maybe its because of all the field managers.

 

Anyway! If you have a non touch screen device (a BB Curve) your code would create a crash. 

 

Here is the updated code I use in the FieldChanged Event

vKeyboard = this.getVirtualKeyboard();
		
		if (vKeyboard != null)
			if (vKeyboard.getVisibility() == 1 && _someFieldToTest != null) {
				if (!_someFieldToTest.isFocus())
					getVirtualKeyboard().setVisibility(VirtualKeyboard.HIDE);
		}