Code example for PreferenceCategory

Methods: setTitle, addPreference

0
	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);
 
	IntEditTextPreference buttonsPerRow = new IntEditTextPreference(this);
	buttonsPerRow.setKey(BUTTONS_PER_ROW);
	buttonsPerRow.setTitle("Buttons per row");
	buttonsPerRow.setDialogTitle("Buttons per row (1 - 4)");
	buttonsPerRow.setDefaultValue(2);
	buttonsPerRow.setBounds(1, 4);
	root.addPreference(buttonsPerRow);
 
	IntEditTextPreference numSliders = new IntEditTextPreference(this);
	numSliders.setKey(NUM_SLIDERS);
	numSliders.setTitle("Number of sliders");
	numSliders.setDialogTitle("Number of sliders (0 - 4)");
	numSliders.setDefaultValue(0);
	numSliders.setBounds(0, 4);
	root.addPreference(numSliders);
 
	generateSliderPreferences(root);
    } 
 
    private void generateButtonPreferences(PreferenceCategory root) {