How to get the token needed for hideSoftInputFromInputMethod (tokens, flags)?

So, I'm trying to make android IME. I need the ability to hide IME from my IME. So far, I have only seen examples of how to show \ hide IME from activity, but I need to do this from IME. I recognized InputMethodManager.hideSoftInputFromInputMethod(token,flags) , but it needs a token, and I cannot figure out how to get it. getCurrentInputBinding().getConnectionToken() does not work - this causes the application to crash. Any ideas?

+4
source share
1 answer

Presumably, based on the answers to this question in other places (I'm still trying to find a working method myself), the desired token is from your TextView.getWindowToken ().

However, this does not work for me, and I have seen many people with the same complaint.

[edit]
Using the token described above, I was lucky to hide the keyboard with hideSoftInputFromWindow instead of hideSoftInputFromInputMethod. Although, since I did not understand the difference between these functions to begin with, I cannot understand your actual question. Excuse me!
[/ Edit]

0
source

All Articles