Frage

My functionality requires that I've to hide the keyboard(on certain situations) even if the soft keyboard is open in other apps. I've a background service which is able to hide soft keyboard if it is open in my application. But I'm not able to close it from other applications becuase of WindowToken mismatch.

Is there anyway of getting WindowToken of currently running application? (I'm able to get currently running app's package details).

War es hilfreich?

Lösung

WindowToken is used as a security mechanism in android system, wherein it is used to verify the application interacting with the Inputmethod is the application which is currently receiving the input. so exposing it will compromise security. Hence no mechanism is provided by android framework to get the Windowtoken of other applications.

You can look at my other answer for similar question here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top