Modify Default Input Method

Source: Internet
Author: User

[  

How do I modify the default input method?

[Solution]
1. ApplicableICS (Android v4.0)Previous versions:
1. Install the token (.apk)System/APP
2. Modify the fileFrameworks/base/packages/settingsprovider/RES/values/defaults. xml

<String name = "default_input_method" translatable = "false"> Default Input Method id </string>
The red mark indicates the input method ID. For example, if pinyinime is com. Android. inputmethod. Pinyin/. pinyinime
Ii. Applicable to ICS, JB, jb2, And KK versions:
1. the token Input Method (.apk) used in advance will be built into the system (refer to how to preset the APK into the system)

2. Modify the file mEdiatek/config/$ {project}/projectconfig. mk
Set the macro default_input_method value to the required input method;
For example, pinyinime is set to default_input_method = com. Android. inputmethod. Pinyin. pinyinime.

This value is the package name that contains the inputmethodservice subclass in the source code of the input method. The class name that implements the inputmethodservice subclass. Here there is one "/" fewer than the complete class name printed in log. Note that

Additional instructions:

You do not need to modify the KK version:

The above modification method only applies to the input method in the format of COM. Android. inputmethod. Pinyin/. pinyinime by default (that is, the class name is followed by the backslash ),

For com. Google. Android
Oid. inputmethod. Latin/COM. Android. inputmethod. Latin. latinime (that is, when the backslash is followed by the complete class name ),

In this case, mediatek/config/$ {project}/projectconfig. mk cannot be modified.
Default_input_method to set the default input method.

Use com. Google. Android
Oid. inputmethod. Latin/COM. Android. inputmethod. Latin. latinime

Use the following method to modify the settings. In settingsprovider databasehelper. Java
Yes
Log. I (TAG, "defaultime:" + defaultime );
If (defaultime! = NULL ){
Stringbuffer strbuffer = new stringbuffer (defaultime );
Int lastdotpos = defaultime. lastindexof (".");
String strinsert = "/";
Strbuffer. insert (lastdotpos, strinsert );
Loadsetting (stmt, settings. Secure. default_input_method,
Strbuffer. tostring ());
} Else {
Log. I (TAG, "Default IME from imefeatureoption is null !! ");
}
Delete part of the default initialization code, that is, delete the following code.
Log. I (TAG, "defaultime:" + defaultime );
If (defaultime! = NULL ){
Stringbuffer strbuffer = new stringbuffer (defaultime );
Int lastdotpos = defaultime. lastindexof (".");
String strinsert = "/";
Strbuffer. insert (lastdotpos, strinsert );
Loadsetting (stmt, settings. Secure. default_input_method,
Strbuffer. tostring ());
} Else {
Log. I (TAG, "Default IME from imefeatureoption is null !! ");
}
Add
Loadsetting (stmt, settings. Secure. enabled_input_methods,
"Com. Google. Android
Oid. inputmethod. Latin/COM. Android. inputmethod. Latin. latinime "); // modify the default enable input method.

Loadsetting (stmt, settings. Secure. default_input_method,
"Com. Google. Android
Oid. inputmethod. Latin/COM. Android. inputmethod. Latin. latinime "); // modify the default input method.

 

 

[Description]

 

Some branch versions of KK fail to set the default input method because the later versions of KK moved the default input code to inputmethodmanagerservice. java.

 

 

[Solution]

 

First, check whether the systemrunning function in inputmethodmanagerservice. Java contains the following red code. If yes, comment out the blue statement after the red one. If there is no red code, refer to faq06663.

 

 

 

If (! Mimeselectedonboot ){
Slog. W (TAG, "reset the default IME as \" resource \ "is ready here .");
/// M: loading preinstalled IME from feature option .@{
String preinstalledimename = imefeatureoption. default_input_method;
Slog. I (TAG, "imefeatureoption defaultime:" + preinstalledimename );
If (preinstalledimename! = NULL ){
Inputmethodinfo preinstalledimi = NULL;
For (inputmethodinfo Imi: Invalid hodlist ){
Slog. I (TAG, "Your hodlist service info:" + Imi. getservicename ());
If (preinstalledimename. Equals (imi. getservicename ())){
Preinstalledimi = Imi;
Break;
}
}
If (preinstalledimi! = NULL ){
Setinputmethodlocked (preinstalledimi. GETID (), not_a_subtype_id );
} Else {
Slog. W (TAG, "set preinstall IME as default fail .");
Resetdefaultimelocked (mcontext );
}
}
///@}
Resetstateifcurrentlocalechangedlocked ();
Inputmethodutils. setnonselectedsystemimesdisableduntilused (
Mcontext. getpackagemanager (),
Msettings. getenabledinputmethodlistlocked ());
} After the system language is switched in JB and KK, the default input method is automatically switched to the Latin input method, or the Default Input Method preset by the system cannot take effect. [solution]

JB solution:

In the inputmethodmanagerservice. Java file

At the end of the constructor inputmethodmanagerservice, comment out the events that receive language change broadcasts:

Final intentfilter filter = new intentfilter ();

Filter. addaction (intent. action_locale_changed );

Mcontext. registerreceiver (

New broadcastreceiver (){

@ Override

Public void onreceive (context, intent ){

Synchronized (synchronized hodmap ){

// Checkcurrentlocalechangedlocked (); // comment out this row

}

}

}, Filter );

In this way, you can.

Kk solution:

In the inputmethodmanagerservice. Java file

At the end of the constructor inputmethodmanagerservice, comment out the events that receive language change broadcasts:

Final intentfilter filter = new intentfilter ();
Filter. addaction (intent. action_locale_changed );
Mcontext. registerreceiver (
New broadcastreceiver (){
@ Override
Public void onreceive (context, intent ){
Synchronized (synchronized hodmap ){
// Resetstateifcurrentlocalechangedlocked (); // comment out this row
}
}
}, Filter );

In this way, you can.

 

 

Modify Default Input Method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.