tags:

views:

68

answers:

1

I added a BroadCastReceiver to my application. I want to call my inputMethod's method but I can't find a way to access it's instance.

I read I can get an InputMethodManager by:

InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

but I couldn't find a way to get the the InputMethod instance from the InputMethodManager.

Is doing a singleton the only way to access it?

A: 

I think yes. At least, that's what I've got working in my app to hide the on-screen keyboard:

InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getWindowToken(), 0);
alex