Preference setEnabled - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setEnabled, setChecked
    } 
 
    private void handleNsdStateChanged(int newState) {
        switch (newState) {
            case NsdManager.NSD_STATE_DISABLED:
                mCheckbox.setChecked(false);
                mCheckbox.setEnabled(true);
                break; 
            case NsdManager.NSD_STATE_ENABLED:
                mCheckbox.setChecked(true);
                mCheckbox.setEnabled(true);
                break; 
        } 
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setEnabled, setOnPreferenceChangeListener, isChecked
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setEnabled, setChecked
        } 
        return false; 
    } 
 
    private void handleP2pStateChanged(int state) {
        mCheckBox.setEnabled(true);
        switch (state) {
            case WifiP2pManager.WIFI_P2P_STATE_ENABLED:
                mCheckBox.setChecked(true);
                break; 
            case WifiP2pManager.WIFI_P2P_STATE_DISABLED:
                mCheckBox.setChecked(false);
                break; 
            default: 
                Log.e(TAG,"Unhandled wifi state " + state);
                break; 
        } 
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getContext, getSharedPreferences, setEnabled, setSummary
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.layout.recentvideo_setting);
	 } 
	 
	@Override 
	public void onResume() { 
		super.onResume(); 
		final EditTextPreference pref = (EditTextPreference)findPreference("recentvideo_last_refresh");
		new RecentVideoRefreshPrefUpdater(pref);
	} 
} 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setEnabled
        return false; 
    } 
 
    private void updateWidgetState(boolean enable) {
        mPlayExample.setEnabled(enable);
        mDefaultRatePref.setEnabled(enable);
    } 
 
    private void displayNetworkAlert() { 
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(android.R.string.dialog_alert_title);
        builder.setIconAttribute(android.R.attr.alertDialogIcon);
        builder.setMessage(getActivity().getString(R.string.tts_engine_network_required));
        builder.setCancelable(false);
        builder.setPositiveButton(android.R.string.ok, null);
 
        AlertDialog dialog = builder.create();
        dialog.show();
    } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getContext, getSharedPreferences, setEnabled, setSummary
		this.pref = pref;
		setValues(); 
	} 
 
	private void setValues() { 
		String timeAgoStr = pref.getSharedPreferences().getString("recentvideo_last_refresh", "0");
		String text = "";
		if(timeAgoStr == null || timeAgoStr.length() == 0)  {
			text = "Not yet";
		} 
		else { 
			long timeAgo = Long.valueOf(timeAgoStr);
			text = TimeAgo.toFriendlyString(pref.getContext(), timeAgo);
		} 
		 
		pref.setSummary(text);
		pref.setEnabled(false);
	} 
} 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setEnabled, setSummary
This code example shows how to use the following methods:setEntries, setEntryValues, setSummary, setValue, setEnabled
	public static void PopulateList(Preference preference, String[] List) {
		ListPreference PrefList = (ListPreference)preference;
		if (List == null) {
			PrefList.setEnabled(false);
		} else { 
			PrefList.setEntryValues(List); 
			PrefList.setEntries(List);
			PrefList.setEnabled(true);
		} 
	} 
 
	// 
	// fill filesystem lists with files from array of strings[] 
	// 
	public static void PopulateFSList(Preference preference, String[] List, String filesystem) {
		PopulateList(preference, List);
		ListPreference PrefList = (ListPreference)preference;
		if (filesystem != null) {
			String currentfs = GetCurrentFileSystem(filesystem);
			PrefList.setSummary("current filesystem: " +  currentfs);

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setEnabled
    @SuppressWarnings( "deprecation" ) 
    public static void enablePreference( PreferenceActivity activity, String key, boolean enabled )
    { 
        Preference preference = activity.findPreference( key );
        if( preference != null )
            preference.setEnabled( enabled );
    } 
     
    @SuppressWarnings( "deprecation" ) 
    public static void removePreference( PreferenceActivity activity, String keyParent,
            String keyChild )
    { 
        Preference parent = activity.findPreference( keyParent );
        Preference child = activity.findPreference( keyChild );
        if( parent instanceof PreferenceGroup && child != null )
            ( (PreferenceGroup) parent ).removePreference( child );
    } 
 
    public static void validateListPreference( Resources res, SharedPreferences prefs, String key, int defaultResId, int arrayResId )
    { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getValue, setSummary, setEnabled
    	} else if (key.equals("use_auto_reftriggers") && !use_auto_reftriggers.isChecked()) {
    		autoref_period.setEnabled(false);
    	} 
    	 
    	if (key.equals("use_timecorrection") && use_timecorrection.isChecked()) {
    		time_correction.setEnabled(true);
    	} else if (key.equals("use_timecorrection") && !use_timecorrection.isChecked()) {
    		time_correction.setEnabled(false);
    	} 
    	 
    	if (key.equals("autoref_period"))
    	autoref_period.setSummary("Auto refresh period: "+autoref_period.getValue()+" sec");
    	if (key.equals("time_correction"))
    	time_correction.setSummary("Timezone correction: "+time_correction.getValue()+" hour(s)");
    } 
     
    @Override 
    protected void onResume() { 
        super.onResume(); 
        // Set up a listener whenever a key changes 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Preference setEnabled Questions & Answers:

setEnabled Method Overview
Sets whether this Preference is enabled.
See Code Examples for other Android Preference Methods: