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