Android keyboard input language setting default to open Myanmar Burmese step _android

Source: Internet
Author: User
Tags locale
Locale is through the system settings of the region and Latin input language through the merger out, so in the system locale and input language support can be in the input language settings

Languagelist is read from the Latin_preferences.xml file that stores the Latin Input method settings, the input language that was last set

If you want to set a language in the input method by default open can click the steps to add files, I have been verified here OK, you can try.
Provide a simple sample code, such as the default Burmese, English, French input method tick:

1. Writing Document Latinimereceiver.java
Copy Code code as follows:

Package com.android.inputmethod.latin;
Import Android.content.BroadcastReceiver;
Import Android.content.Context;
Import android.content.Intent;
Import android.content.SharedPreferences;
Import Android.content.SharedPreferences.Editor;
Import Android.preference.PreferenceManager;
Import android.provider.Settings;
Import Android.util.Log;
Import Android.view.inputmethod.InputMethodInfo;
Import Android.view.inputmethod.InputMethodManager;
Import Android.view.inputmethod.InputMethodSubtype;
Import Android.text.TextUtils;
public class Latinimereceiver extends Broadcastreceiver {
private static final String TAG = LatinImeReceiver.class.getSimpleName ();
@Override
public void OnReceive (context context, Intent Intent) {
LOG.D ("Latinimereceiver", "Step1");
Sharedpreferences sp = context.getsharedpreferences ("Com.android.inputmethod.latin_preferences",
Context.mode_private);
Boolean hasset = Sp.getboolean ("Has_set", false);
if (!hasset) {
LOG.D ("Latinimereceiver", "Step2");
Editor Editor = Sp.edit ();
LOG.D ("Latinimereceiver", "step3");
Editor.putstring (Latinime.pref_selected_languages, "EN_US,MY,FR"); The default will be English, Burmese check, specific how to write can refer to the Inputlanguageselection.java in the Whitelist_languages
Editor.putboolean ("Has_set", true);
LOG.D ("Latinimereceiver", "Step4");
Editor.commit ();
Sharedpreferencescompat.apply (editor);
LOG.D ("Latinimereceiver", "step5");
}
}

Place it under the Path Packages/inputmethods/latinime/java/src/com/android/inputmethod/latin folder

2. Register intent, add in the last side of Packages/inputmethods/latinime/java/androidmanifest.xml:
and add <uses-permission android:name= "Android.permission.RECEIVE_BOOT_COMPLETED"/> Permissions
Copy Code code as follows:

<receiver android:name= "Latinimereceiver" android:enabled= "true" >
<intent-filter>
<action android:name= "Android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
Related Article

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.