本文整理汇总了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);
}