當前位置: 首頁>>代碼示例>>Java>>正文


Java Preference.getIntent方法代碼示例

本文整理匯總了Java中android.preference.Preference.getIntent方法的典型用法代碼示例。如果您正苦於以下問題:Java Preference.getIntent方法的具體用法?Java Preference.getIntent怎麽用?Java Preference.getIntent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.Preference的用法示例。


在下文中一共展示了Preference.getIntent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.prefs_screen_correction);

    final Context context = getActivity();
    final PackageManager pm = context.getPackageManager();

    final Preference dictionaryLink = findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
    final Intent intent = dictionaryLink.getIntent();
    intent.setClassName(context.getPackageName(), DictionarySettingsActivity.class.getName());
    final int number = pm.queryIntentActivities(intent, 0).size();
    if (0 >= number) {
        removePreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
    }

    final Preference editPersonalDictionary =
            findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY);
    final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent();
    final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null
            : pm.resolveActivity(
                    editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY);
    if (ri == null) {
        overwriteUserDictionaryPreference(editPersonalDictionary);
    }

    mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT);
    turnOffUseContactsIfNoPermission();
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:30,代碼來源:CorrectionSettingsFragment.java

示例2: updateSubtypeEnabler

import android.preference.Preference; //導入方法依賴的package包/類
public void updateSubtypeEnabler() {
    final Preference pref = mSubtypeEnablerPreference;
    if (pref == null) {
        return;
    }
    final Context context = pref.getContext();
    final CharSequence title;
    if (mSubtypeEnablerTitleRes != 0) {
        title = context.getString(mSubtypeEnablerTitleRes);
    } else {
        title = mSubtypeEnablerTitle;
    }
    pref.setTitle(title);
    final Intent intent = pref.getIntent();
    if (intent != null) {
        intent.putExtra(Intent.EXTRA_TITLE, title);
    }
    final String summary = getEnabledSubtypesLabel(context, mImm, mImi);
    if (!TextUtils.isEmpty(summary)) {
        pref.setSummary(summary);
    }
    if (mSubtypeEnablerIconRes != 0) {
        pref.setIcon(mSubtypeEnablerIconRes);
    } else {
        pref.setIcon(mSubtypeEnablerIcon);
    }
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:28,代碼來源:InputMethodSettingsImpl.java


注:本文中的android.preference.Preference.getIntent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。