Toggle Keyboard

Put your problem here if it does not fit any of the other categories.

Toggle Keyboard

Postby pazo » Mon Mar 19, 2012 2:39 am

Hi all -- I'm new to this forum and Android programming and hoping someone can help.

I have an EditText field, and next to it an ImageView of a little keyboard. The goal is for users to click on that keyboard to toggle the keyboard on and off.

I think I know how to turn the keyboard on and off by using the methods below, but I first need to check if the keyboard is already displaying.

Can someone provide the code to check if keyboard is showing -- kind of like below:

imgKeyboard = (ImageView) findViewById(R.id.keyboard);
imgKeyboard.setOnClickListener(this);

onClick of ImageView{ // little keyboard image
if(keyboard is showing){
InputMethodManager keyboard = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
keyboard.hideSoftInputFromWindow(txtInput.getWindowToken(), 0);
} else {
InputMethodManager keyboard = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
keyboard.showSoftInput(txtInput, 0);
}
}
pazo
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Mar 19, 2012 2:14 am

Top

Re: Toggle Keyboard

Postby Phyll » Thu Mar 22, 2012 9:34 pm

Hi pazo,

I wasn't sure myself so I looked around some. It appears that there is no way to do that. If you want to see one of the other threads about that here is one with some links and stuff:

http://stackoverflow.com/questions/4747 ... the-screen

You might use your keyboard button to always turn it on and not worry about turning it off.

Not much help.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: TurnitinBot [Bot] and 14 guests