本文整理汇总了Java中android.preference.PreferenceCategory.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceCategory.setTitle方法的具体用法?Java PreferenceCategory.setTitle怎么用?Java PreferenceCategory.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.PreferenceCategory
的用法示例。
在下文中一共展示了PreferenceCategory.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_wireless_socket);
setHasOptionsMenu(true);
PreferenceScreen preferenceScreen = this.getPreferenceScreen();
PreferenceCategory preferenceCategory = new PreferenceCategory(preferenceScreen.getContext());
preferenceCategory.setTitle("Wireless sockets");
preferenceScreen.addPreference(preferenceCategory);
for (int index = 0; index < WirelessSocketService.getInstance().GetDataList().getSize(); index++) {
WirelessSocket wirelessSocket = WirelessSocketService.getInstance().GetDataList().getValue(index);
SwitchPreference preference = new SwitchPreference(preferenceScreen.getContext());
preference.setTitle(wirelessSocket.GetName());
preference.setKey(wirelessSocket.GetSettingsKey());
preference.setDefaultValue(false);
preferenceCategory.addPreference(preference);
bindPreferenceSummaryToValue(preference);
}
}
示例2: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'notifications' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_notification);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("display_name"));
bindPreferenceSummaryToValue(findPreference("display_image"));
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
示例3: onCreate
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
PreferenceCategory category = new PreferenceCategory(getActivity());
category.setTitle("Libraries");
screen.addPreference(category);
CheckBoxPreference checkBoxPref = new CheckBoxPreference(getActivity());
checkBoxPref.setTitle("title");
checkBoxPref.setSummary("summary");
checkBoxPref.setChecked(true);
category.addPreference(checkBoxPref);
setPreferenceScreen(screen);
}
示例4: createInstrumentPrefs
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Create the "Select Instruments For Each Track " lists.
* The list of possible instruments is in MidiFile.java.
*/
private void createInstrumentPrefs(PreferenceScreen root) {
PreferenceCategory selectInstrTitle = new PreferenceCategory(this);
selectInstrTitle.setTitle(R.string.select_instruments_per_track);
root.addPreference(selectInstrTitle);
selectInstruments = new ListPreference[options.tracks.length];
for (int i = 0; i < options.instruments.length; i++) {
selectInstruments[i] = new ListPreference(this);
selectInstruments[i].setOnPreferenceChangeListener(this);
selectInstruments[i].setEntries(MidiFile.Instruments);
selectInstruments[i].setEntryValues(MidiFile.Instruments);
selectInstruments[i].setTitle("Track " + i);
selectInstruments[i].setValueIndex(options.instruments[i]);
selectInstruments[i].setSummary(selectInstruments[i].getEntry());
root.addPreference(selectInstruments[i]);
}
setAllToPiano = new Preference(this);
setAllToPiano.setTitle(R.string.set_all_to_piano);
setAllToPiano.setOnPreferenceClickListener(this);
root.addPreference(setAllToPiano);
}
示例5: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'data and sync' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_server);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_server);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("server_custom_url"));
bindPreferenceSummaryToValue(findPreference("server_custom_sender_id"));
findPreference("general_reset").setOnPreferenceClickListener(sBindOnPreferenceClickListener);
findPreference("server_register").setOnPreferenceClickListener(sBindOnPreferenceClickListener);
}
示例6: connectDebugButtons
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Iterate through debug buttons, adding a special debug preference click
* listener to each of them.
*/
protected void connectDebugButtons() {
// Separate listener to really separate debug logic from main code paths.
final OnPreferenceClickListener listener = new DebugPreferenceClickListener();
// We don't want to use Android resource strings for debug UI, so we just
// use the keys throughout.
final PreferenceCategory debugCategory = (PreferenceCategory) ensureFindPreference("debug_category");
debugCategory.setTitle(debugCategory.getKey());
for (int i = 0; i < debugCategory.getPreferenceCount(); i++) {
final Preference button = debugCategory.getPreference(i);
button.setTitle(button.getKey()); // Not very friendly, but this is for debugging only!
button.setOnPreferenceClickListener(listener);
}
}
示例7: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'data' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_data);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_data);
// Bind the summaries of relevant preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_destination)));
// bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_keep_account)));
}
示例8: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'advanced' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_advanced);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_advanced);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("pref_defaultopts"));
// Advanced
bindPreferenceSummaryToValue(findPreference("pref_updateurl"));
bindPreferenceSummaryToValue(findPreference("pref_binaryloc"));
}
示例9: onResume
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
final PreferenceCategory defaultCat = (PreferenceCategory) findPreference(getString(R.string.pref_GeneralSettings));
defaultCat.setTitle("Version: " + getAppVersion());
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
示例10: addCategory
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private PreferenceCategory addCategory(String title, PreferenceScreen screen, String key, Drawable icon, Context context) {
PreferenceCategory c = new PreferenceCategory(context);
c.setTitle(title);
if (null != key) c.setKey(key);
if (null != icon) c.setIcon(icon);
screen.addPreference(c);
return c;
}
示例11: passwordListAvailable
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void passwordListAvailable(int count) {
resetList(PREF_CATEGORY_SAVED_PASSWORDS);
mNoPasswords = count == 0;
if (mNoPasswords) {
if (mNoPasswordExceptions) displayEmptyScreenMessage();
return;
}
displayManageAccountLink();
PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
profileCategory.setTitle(R.string.section_saved_passwords);
profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
getPreferenceScreen().addPreference(profileCategory);
for (int i = 0; i < count; i++) {
PasswordUIView.SavedPasswordEntry saved =
mPasswordManagerHandler.getSavedPasswordEntry(i);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
String url = saved.getUrl();
String name = saved.getUserName();
screen.setTitle(url);
screen.setOnPreferenceClickListener(this);
screen.setSummary(name);
Bundle args = screen.getExtras();
args.putString(PASSWORD_LIST_NAME, name);
args.putString(PASSWORD_LIST_URL, url);
args.putInt(PASSWORD_LIST_ID, i);
profileCategory.addPreference(screen);
}
}
示例12: passwordExceptionListAvailable
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void passwordExceptionListAvailable(int count) {
resetList(PREF_CATEGORY_EXCEPTIONS);
mNoPasswordExceptions = count == 0;
if (mNoPasswordExceptions) {
if (mNoPasswords) displayEmptyScreenMessage();
return;
}
displayManageAccountLink();
PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
profileCategory.setKey(PREF_CATEGORY_EXCEPTIONS);
profileCategory.setTitle(R.string.section_saved_passwords_exceptions);
profileCategory.setOrder(ORDER_EXCEPTIONS);
getPreferenceScreen().addPreference(profileCategory);
for (int i = 0; i < count; i++) {
String exception = mPasswordManagerHandler.getSavedPasswordException(i);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
screen.setTitle(exception);
screen.setOnPreferenceClickListener(this);
Bundle args = screen.getExtras();
args.putString(PASSWORD_LIST_URL, exception);
args.putInt(PASSWORD_LIST_ID, i);
profileCategory.addPreference(screen);
}
}
示例13: onCreate
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(this);
PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.filter_pokemons);
screen.addPreference(category);
try {
JSONArray pokemonList = new JSONArray(Utils.loadJSONFromFile(this, "pokemon.json"));
for (int i = 0; i < pokemonList.length(); i++){
JSONObject pokemon = pokemonList.getJSONObject(i);
CheckBoxPreference checkBox = new CheckBoxPreference(this);
checkBox.setTitle(pokemon.getString("Name"));
checkBox.setIcon(new BitmapDrawable(getResources(), Utils.bitmapForPokemon(this, Integer.parseInt(pokemon.getString("Number")))));
checkBox.setDefaultValue(true);
checkBox.setSummary(String.format(getString(R.string.setting_filter_pokemon_summary), pokemon.getString("Name")));
checkBox.setKey("pref_key_show_pokemon_" + Integer.parseInt(pokemon.getString("Number")));
category.addPreference(checkBox);
}
} catch (JSONException e) {
e.printStackTrace();
}
setPreferenceScreen(screen);
}
示例14: createCategory
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Create a category using the specified string resource for the title
* @param titleResId resource ID to use for the title
* @return newly created category
*/
private PreferenceCategory createCategory(@StringRes int titleResId) {
PreferenceCategory preferenceCategory = new PreferenceCategory(getActivity());
preferenceCategory.setTitle(titleResId);
getPreferenceScreen().addPreference(preferenceCategory);
return preferenceCategory;
}
示例15: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_general);
addPreferencesFromResource(R.xml.pref_general);
}