EditTextPreference getText - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for EditTextPreference getText method.

This code example shows how to use the following methods:getText, setSummary
        super.onResume(); 
        updatePreferenceSummaries(); 
    } 
 
    private void updateSummary(EditTextPreference pref, String defaultText) {
        String value = pref.getText();
        if (value != null && value.length() > 0) {
            pref.setSummary(value);
        } else { 
            pref.setSummary(defaultText);
        } 
    } 
        
    private void updatePreferenceSummaries() { 
        updateSummary(urlPref, "URL to garage endpoint");
        updateSummary(ssidPref, "House wifi's SSID to look for");
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
6
CodeRank
This code example shows how to use the following methods:getText
This code example shows how to use the following methods:getEditText, getText, getOnPreferenceChangeListener, setOnPreferenceChangeListener, onPreferenceChange
public class MyPrefScreen extends PreferenceActivity {
	static final LogCategory log = new LogCategory("MyPrefScreen");
	 
	void initNumberEdit(String key,int min,int max,int def,int desc_string_id){
		EditTextPreference pref = (EditTextPreference)findPreference(key);
		EditText et = pref.getEditText();
		et.setHorizontallyScrolling(true);
		et.setSingleLine(true);
		et.setInputType(InputType.TYPE_CLASS_NUMBER);
 
		final int _min = min;
		final int _max = max;
		final int _def = def;
		final int _desc_string_id = desc_string_id;
		 
		pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
			@Override 
			public boolean onPreferenceChange(Preference preference, Object newValue) {
				if(!MyApp.checkInteger(newValue,_min,_max)){
					Toast.makeText(MyPrefScreen.this,R.string.number_range_error,Toast.LENGTH_SHORT).show();

6
CodeRank
This code example shows how to use the following methods:getText, setSummary
  } 
 
  private void updateUserText() { 
    EditTextPreference pref;
    pref = (EditTextPreference) findPreference("pref_username");
    String user = pref.getText();
 
    if (user == null) {
      user = "?";
    } 
 
    pref.setSummary(String.format("Username: %s", user));
  } 
} 
6
CodeRank
This code example shows how to use the following methods:getText, setOnPreferenceChangeListener, setSummary
        addButtons(); 
    } 
 
    void bindLabelToValue (EditTextPreference preference)
    { 
        preference.setSummary(preference.getText());
        preference.setOnPreferenceChangeListener(
            new Preference.OnPreferenceChangeListener() {
                public boolean onPreferenceChange(Preference p, Object newValue) {
                    p.setSummary((String) newValue);
                    return true; 
                } 
            }); 
    } 
 
    // Based on code from the DeskClock app 
    void addButtons () 
    { 
        getListView().setItemsCanFocus(true);
 
6
CodeRank
This code example shows how to use the following methods:getText, setSummary
This code example shows how to use the following methods:getText, setIntent, setOnPreferenceClickListener, setSummary
		super.onResume(); 
		// register pref change listener 
		getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
		 
		//TODO updatePreferences() containing following and others 
		pEtFolder.setSummary(pEtFolder.getText());
		setFolderPreferenceClickIntent(); 
		updateIntervalSummary(); 
		updateIntervalTypesEnabled(); 
		updatePTpDailyTime(); 
	} 
 
	// release the sharedPreferenceListener 
	@Override 
	protected void onPause() 
	{ 
		super.onPause(); 
		getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
	} 
	 

5
CodeRank
This code example shows how to use the following methods:getText, setSummary
This code example shows how to use the following methods:getText, setText, setSummary
		} 
		 
		if (key.endsWith("urlServidor")) {
			Preference pref = findPreference(key);
			EditTextPreference txt = (EditTextPreference) pref;
			if (txt.getText().length() > 0) {
				txt.setText("http://"+txt.getText().replace("http://", ""));
				txt.setSummary("http://"+txt.getText().replace("http://", ""));
			} 
		} 
		 
		if (key.endsWith("portaServidor")) {
			Preference pref = findPreference(key);
			EditTextPreference txt = (EditTextPreference) pref;
			if (txt.getText().length() > 0) {
				 
				txt.setSummary(txt.getText());
			 
			} 
		} 
5
CodeRank
This code example shows how to use the following methods:getText, setSummary

Related EditTextPreference getText Questions & Answers:

getText Method Overview
Gets the text from the SharedPreferences.
See Code Examples for other Android EditTextPreference Methods: