亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android鍵盤輸入語言設(shè)置默認(rèn)打開myanmar緬甸語的步驟

 更新時(shí)間:2013年06月17日 15:56:56   作者:  
如何實(shí)現(xiàn)Android鍵盤輸入語言默認(rèn)打開為myanmar緬甸語,如果要設(shè)置某種語言在輸入法默認(rèn)打開可按一下步驟添加文件,我這里已經(jīng)驗(yàn)證時(shí)OK的
locale是通過系統(tǒng)設(shè)置的地區(qū)和latin輸入法語言通過merger出來的,所以在系統(tǒng)地區(qū)設(shè)置和輸入法語言中同時(shí)支持才可以在“輸入語言設(shè)置“里設(shè)置

languageList是從存儲latin輸入法設(shè)置的latin_preferences.xml文件里讀取出來的,上一次設(shè)置的輸入語言

如果要設(shè)置某種語言在輸入法默認(rèn)打開可按一下步驟添加文件,我這里已經(jīng)驗(yàn)證時(shí)OK的,你可以試一下。
提供簡單的sample code,如默認(rèn)將緬甸語、英文、法語輸入法勾選:

1.書寫文件LatinImeReceiver.java
復(fù)制代碼 代碼如下:

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"); //默認(rèn)將英語、緬甸語勾選,具體該怎么寫可以參考inputlanguageselection.java中的WHITELIST_LANGUAGES
editor.putBoolean("has_set", true);
Log.d("LatinImeReceiver", "step4");
//editor.commit();
SharedPreferencesCompat.apply(editor);
Log.d("LatinImeReceiver", "step5");
}
}

將其放置到路徑packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin文件夾下面

2.注冊intent,在packages/inputmethods/LatinIME/java/androidManifest.xml中的最后面加入:
并增加 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />權(quán)限
復(fù)制代碼 代碼如下:

<receiver android:name="LatinImeReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

相關(guān)文章

最新評論