当前位置: 首页>>代码示例>>Java>>正文


Java Preference.OnPreferenceClickListener方法代码示例

本文整理汇总了Java中android.preference.Preference.OnPreferenceClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Preference.OnPreferenceClickListener方法的具体用法?Java Preference.OnPreferenceClickListener怎么用?Java Preference.OnPreferenceClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.Preference的用法示例。


在下文中一共展示了Preference.OnPreferenceClickListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle _savedInstanceState) {
    super.onCreate(_savedInstanceState);
    addPreferencesFromResource(R.xml.pref_settings_help);

    mActionBar.setTitle(R.string.settings_information_help_title);

    Preference mainList = findPreference("settings_key_main_list");
    Preference mainMemoCreate = findPreference("settings_key_main_memocreate");
    Preference mainDelete = findPreference("settings_key_main_delete");
    Preference mainOpenFolder = findPreference("settings_key_main_openfolder");
    Preference folderList = findPreference("settings_key_folder_list");
    Preference folderDefault = findPreference("settings_key_folder_default");
    Preference folderCreate = findPreference("settings_key_folder_create");
    Preference folderDelete = findPreference("settings_key_folder_delete");
    Preference folderExternal = findPreference("settings_key_foler_external");
    Preference memoSaveLength = findPreference("settings_key_memo_savelengthlimited");
    Preference memoFontColor = findPreference("settings_key_memo_fontcolor");
    Preference memoEdit = findPreference("settings_key_memo_edit");
    Preference etcAboutHelp = findPreference("settings_key_etc_abouthelp");
    Preference etcBackup = findPreference("settings_key_etc_backup");
    Preference etcFileColor = findPreference("settings_key_etc_filecolor");
    Preference etcPermission = findPreference("settings_key_etc_permission");
    Preference etcAd = findPreference("settings_key_etc_ad");
    Preference etcFontBroken = findPreference("settings_key_etc_fontbroken");
    Preference etcWidget = findPreference("settings_key_etc_widget");

    Preference.OnPreferenceClickListener clickListener = new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference _preference) {
            Intent intent = new Intent();
            intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            intent.setClass(getActivity(), HelpContentsActivity.class);
            intent.putExtra(Constant.INTENT_EXTRA_HELP_INDEX, _preference.getKey());
            startActivity(intent);
            getActivity().overridePendingTransition(0, 0);
            return false;
        }
    };

    mainList.setOnPreferenceClickListener(clickListener);
    mainMemoCreate.setOnPreferenceClickListener(clickListener);
    mainDelete.setOnPreferenceClickListener(clickListener);
    mainOpenFolder.setOnPreferenceClickListener(clickListener);
    folderExternal.setOnPreferenceClickListener(clickListener);
    folderDelete.setOnPreferenceClickListener(clickListener);
    folderCreate.setOnPreferenceClickListener(clickListener);
    folderDefault.setOnPreferenceClickListener(clickListener);
    folderList.setOnPreferenceClickListener(clickListener);
    memoFontColor.setOnPreferenceClickListener(clickListener);
    memoSaveLength.setOnPreferenceClickListener(clickListener);
    memoEdit.setOnPreferenceClickListener(clickListener);
    etcAboutHelp.setOnPreferenceClickListener(clickListener);
    etcBackup.setOnPreferenceClickListener(clickListener);
    etcFileColor.setOnPreferenceClickListener(clickListener);
    etcPermission.setOnPreferenceClickListener(clickListener);
    etcAd.setOnPreferenceClickListener(clickListener);
    etcFontBroken.setOnPreferenceClickListener(clickListener);
    etcWidget.setOnPreferenceClickListener(clickListener);
}
 
开发者ID:Eskeptor,项目名称:OpenPad-for-Android,代码行数:61,代码来源:SettingsActivity.java


注:本文中的android.preference.Preference.OnPreferenceClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。