Sunday, February 9, 2014
100 points! About setInputMethod () to switch input method, not token. Seeking to switch the input method method
Recently, the demand needed to switch the input method,
Know that there are two ways, one InputMethodManager.setInputMethod (IBinder token, String id)
One is InputMethodService.switchInputMethod (String id)
After a test is the first, the first argument how else fails, I can only get this program I tried
a Viewview.getWindowToken ()
view.getApplicationWindowToken () pass in the two methods, they can not be changed.
And with InputMethodService.switchInputMethod (String id) that I simply do not know how to get the instance InputMethodService,
Try new one, and the results reported null pointer ~ ~ ~
Daniel help you see how to switch input method, provided that I only got a view of this program, because I was modified in the framework of inputmethodmanager.java, the current changes are focusin () method, focusin () only came a view program, in addition setInputMethod (IBinder token, String id) itself is this kind of approach.
Reply:
This can be obtained by writing to the system input method ID settings to accomplish this is probably code:
Settings.Secure.putString (contentResovler, Settings.Secure.DEFAULT_INPUT_METHOD, "input method ID");
InputManagerService listens change this setting item.
Reply:
This seems to be related to the AIDL, specifically to ask google
Reply:
This I know, but I do now and then framework which modify settings need to write a program in the system / app is the system program, but now the framework is there to listen to every input method calls the program, if the program itself has permission also, the key to a lot of third-party applications do not have permission.
Reply:
This thing ye ask ah, huh transoceanic phone? ?
Reply:
Anxious, etc.
Reply:
You can try activeActivity.getCurrentFocus (). GetToken ()
Reply:
Reply:
The amount of change has been solved framework
There are other better ways we can talk about ah
Reply:
Can be broadly share with you
Reply:
Maybe I and everyone's needs are not the same, I'm not against the program to switch the input method, but for edittext this control to modify, so I modified the framework InputMethodManager.java of focusIn () method, when per-click EditText This method will be called
Reply:
.Thank you, have not tried
Reply:
Whether the demand is not the same as share your code really do ...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment