Sunday, February 9, 2014

100 points! About setInputMethod () to switch input method, not token. Seeking to switch the input method method


posts by baodinglaolang on 2011-12-01 19:22:59 Edit
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:
cited a floor west_link reply:
This can be written to the system set up by ID in the input method to accomplish this is probably the code:
Settings.Secure.putString (contentResovler, Settings.Secure.DEFAULT_INPUT_METHOD, "input method ID");
InputManagerService listens change this setting item.

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:
reference to the second floor ncuboy045wsq reply:
this seems to relate to AIDL, specifically to ask google

This thing ye ask ah, huh transoceanic phone? ?
Reply:
Anxious, etc.
Reply:
You can try activeActivity.getCurrentFocus (). GetToken ()
Reply:
The reply was deleted at 2011-12-06 13:18:09 moderator

Reply:
The amount of change has been solved framework
There are other better ways we can talk about ah
Reply:
reference to the 8th floor baodinglaolang reply:
have solved the amount of change framework
There are other better ways we can talk about ah


Can be broadly share with you
Reply:
reference to the 9th floor yiyaaixuexi reply:
reference to the 8th floor baodinglaolang reply:

The amount of change has been solved framework
There are other better ways we can talk about ah


Can be broadly share with you


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:
reference to the 6th floor chen2chen2chen2 reply:
can try activeActivity.getCurrentFocus () getToken ()

.Thank you, have not tried
Reply:
Whether the demand is not the same as share your code really do ...

No comments:

Post a Comment