Android PreferenceCategory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PreferenceCategory class.

This code example shows how to use the following methods:findPreference
8
CodeRank
This code example shows how to use the following methods:findPreference
7
CodeRank
This code example shows how to use the following methods:setTitle, addPreference
5
CodeRank
This code example shows how to use the following methods:setTitle, addPreference
	generateControllerPreferences(); 
	generateConsolePreferences(); 
    } 
 
    private void generateControllerPreferences() { 
	PreferenceCategory root = new PreferenceCategory(this);
	root.setTitle("Controller");
	getPreferenceScreen().addPreference(root);
 
	generateButtonPreferences(root);
 
	IntEditTextPreference numButtons = new IntEditTextPreference(this);
	numButtons.setKey(NUM_BUTTONS);
	numButtons.setTitle("Number of buttons");
	numButtons.setSummary("Total number of action buttons");
	numButtons.setDialogTitle("Number of buttons (0 - 20)");
	numButtons.setDefaultValue(2);
	numButtons.setBounds(0, 20);
	root.addPreference(numButtons);
 

5
CodeRank
This code example shows how to use the following methods:findPreference, removePreference
This code example shows how to use the following methods:setTitle, addPreference
	private PreferenceScreen createPreferenceHierarchy() {
		// Root 
		PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
 
		// Launch preferences 
		PreferenceCategory syncPrefCat = new PreferenceCategory(this);
		syncPrefCat.setTitle("Sync accounts");
		root.addPreference(syncPrefCat);
 
		Preference syncDropboxSwitchPref = null;
		int currentapiVersion = android.os.Build.VERSION.SDK_INT;
		if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
			syncDropboxSwitchPref = createSyncDropboxSwitchPref(syncPrefCat);
		} else { 
			syncDropboxSwitchPref = new CheckBoxPreference(this);
		} 
		syncDropboxSwitchPref.setKey("sync_dropbox");
		syncDropboxSwitchPref.setTitle("Dropbox");
		syncDropboxSwitchPref.setSummary(this.dropboxHelper.isLoggedIn() ? "Linked" : "Not linked");
		syncDropboxSwitchPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

5
CodeRank
This code example shows how to use the following methods:setTitle, addPreference
    private PreferenceScreen createPreferenceHierarchy() {
        // Root 
        PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
         
        // Dialog based preferences 
        PreferenceCategory masterInfoPrefCat = new PreferenceCategory(this);
        masterInfoPrefCat.setTitle("Master Username/Password");
        root.addPreference(masterInfoPrefCat);
        //Username edit 
        editUsername = new EditTextPreference(this);
        editUsername.setDialogTitle("Username:");
        editUsername.setKey("edittext_preference");
        editUsername.setTitle("Username");
        editUsername.setSummary("Change master username");
        masterInfoPrefCat.addPreference(editUsername);
        //password edit 
        editPassword = new EditTextPreference(this);
        editPassword.setDialogTitle("Password:");
        editPassword.setKey("edittext_preference");
        editPassword.setTitle("Password");

5
CodeRank
This code example shows how to use the following methods:setTitle, addPreference, PreferenceGroup.addPreference
		setPreferenceScreen(root);
 
		PreferenceCategory generalPreferences = new PreferenceCategory(this);
		generalPreferences.setTitle("General");
		root.addPreference(generalPreferences);
		PreferenceCategory notificationPreferences = new PreferenceCategory(this);
		notificationPreferences.setTitle("Notifications");
		root.addPreference(notificationPreferences);
 
 
		EditTextPreference upcomingRange = new EditTextPreference(this);
		upcomingRange.getEditText().setKeyListener(new NumberKeyListener() {
			 
			protected char[] getAcceptedChars() { 
				char[] numberChars = {'1','2','3','4','5','6','7','8','9','0'};
				return numberChars;
			} 
 
			 
			public int getInputType() { 

5
CodeRank
This code example shows how to use the following methods:setTitle
        return preferenceScreen;
	} 
 
	protected static PreferenceCategory addNewPreferenceCategory(CustomPreferenceActivity context,
			int title, PreferenceScreen prefScreen) {
		PreferenceCategory prefCat = new PreferenceCategory(context);
		prefCat.setTitle(title);
		prefScreen.addPreference(prefCat);
		return prefCat;
	} 
	 
	/**************************************/ 
	/*         ADDING PREFERENCES         */ 
	/**************************************/ 
	 
	public CheckBoxPreference addCheckBoxPreference(PreferenceCategory category,
			int name, int desc, String key, boolean def) {
		CheckBoxPreference preference = new CheckBoxPreference(this);
        preference.setTitle(name);
        preference.setSummary(desc);
5
CodeRank
This code example shows how to use the following methods:setEnabled
		} 
		else 
		{ 
			//Log.d("ServerPreference", "is not checked"); 
			 
			connectionSettings.setEnabled(true);
			ListPreference list     = (ListPreference)findPreference("lpConnectionType");
			SharedPreferences preferences = getSharedPreferences("preferences.xml", Activity.MODE_WORLD_READABLE);
			EditTextPreference ipPreference = (EditTextPreference) findPreference("etIP");
			if(list.getValue().equals(preferences.getString("lpConnectionType", list.getEntryValues()[0].toString())))
			{ 
				 
				 
				ipPreference.setEnabled(false);
			} 
			else 
			{ 
				ipPreference.setEnabled(true);
			} 
			 
4
CodeRank

Related Android PreferenceCategory Questions & Answers:

See Code Examples for Android PreferenceCategory Methods: