Android PreferenceScreen - 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 PreferenceScreen class.

This code example shows how to use the following methods:findPreference
        return preferenceScreen;
    } 
 
    @Implementation 
    public Preference findPreference(CharSequence key) {
        return preferenceScreen.findPreference(key);
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getDialog
	 
	@Test 
	public void shouldSetDialog() { 
		Dialog dialog = new Dialog(new Activity());
 
        assertThat(screen.getDialog()).isNull();
		shadow.setDialog(dialog);
        assertThat(screen.getDialog()).isSameAs(dialog);
	} 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setEnabled
                return; 
            } 
        } 
        mBackup.setChecked(enable);
        mAutoRestore.setEnabled(enable);
        mConfigure.setEnabled(enable);
    } 
 
    @Override 
    protected int getHelpResource() { 
        return R.string.help_url_backup_reset; 
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:findPreference
This code example shows how to use the following methods:setEnabled
        websiteSettings.setEnabled(false);
        WebStorage.getInstance().getOrigins(new ValueCallback<Map>() {
            @Override 
            public void onReceiveValue(Map webStorageOrigins) {
                if ((webStorageOrigins != null) && !webStorageOrigins.isEmpty()) {
                    websiteSettings.setEnabled(true);
                } 
            } 
        }); 
        GeolocationPermissions.getInstance().getOrigins(new ValueCallback<Set<String> >() {
            @Override 
            public void onReceiveValue(Set<String> geolocationOrigins) {
                if ((geolocationOrigins != null) && !geolocationOrigins.isEmpty()) {
                    websiteSettings.setEnabled(true);
                } 
            } 
        }); 
    } 
 
    @Override 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPreference
			{ 
				if (key.equals("gpuPref"))
				{ 
					if (preference.getString(key, "Software Renderer").equals("Software Renderer"))
					{ 
						mainScreen.getPreference(0).setEnabled(false);
						mainScreen.getPreference(1).setEnabled(false);
						mainScreen.getPreference(3).setEnabled(false);
						//mainScreen.getPreference(4).setEnabled(true); 
					} 
					else if (preference.getString(key, "Software Renderer").equals("OGL"))
					{ 
						mainScreen.getPreference(0).setEnabled(true);
						mainScreen.getPreference(1).setEnabled(true);
						mainScreen.getPreference(3).setEnabled(true);
						//mainScreen.getPreference(4).setEnabled(false); 
					} 
				} 
			} 
		}); 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addPreference
                                | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        context.startActivity(intent);
                        return true; 
                    } 
                }); 
        prefScreen.addPreference(mSubtypeEnablerPreference);
        updateSubtypeEnabler(); 
        return true; 
    } 
 
    private static InputMethodInfo getMyImi(Context context, InputMethodManager imm) {
        final List<InputMethodInfo> imis = imm.getInputMethodList();
        for (int i = 0; i < imis.size(); ++i) {
            final InputMethodInfo imi = imis.get(i);
            if (imis.get(i).getPackageName().equals(context.getPackageName())) {
                return imi;
            } 
        } 
        return null; 
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setEnabled
        }); 
        GeolocationPermissions.getInstance().getOrigins(new ValueCallback<Set<String> >() {
            @Override 
            public void onReceiveValue(Set<String> geolocationOrigins) {
                if ((geolocationOrigins != null) && !geolocationOrigins.isEmpty()) {
                    websiteSettings.setEnabled(true);
                } 
            } 
        }); 
    } 
 
    @Override 
    public boolean onPreferenceChange(Preference pref, Object objValue) {
        if (getActivity() == null) {
            // We aren't attached, so don't accept preferences changes from the 
            // invisible UI. 
            Log.w("PageContentPreferencesFragment", "onPreferenceChange called from detached fragment!");
            return false; 
        } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSharedPreferences, findPreference
     *  
     * @param fieldName the preference key name 
     */ 
    public void setStringFieldSummary(String fieldName) {
        PreferenceScreen pfs = getPreferenceScreen();
        SharedPreferences sp = pfs.getSharedPreferences();
        Preference pref = pfs.findPreference(fieldName);
 
        String val = sp.getString(fieldName, null);
        if (TextUtils.isEmpty(val)) {
            val = getDefaultFieldSummary(fieldName);
        } 
        setPreferenceSummary(pref, val);
    } 
 
    /** 
     * Set summary of a password field If empty will display default summary If 
     * password will display a * char for each letter of password 
     *  
     * @param fieldName the preference key name 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:bind
    } 
 
    private void bindPreferences() { 
        final PreferenceScreen preferenceScreen = getPreferenceScreen();
        if (preferenceScreen != null) {
            preferenceScreen.bind(lv);
        } 
    } 
 
    /** 
     * Creates the {@link PreferenceManager}. 
     * 
     * @return The {@link PreferenceManager} used by this activity. 
     */ 
    private PreferenceManager onCreatePreferenceManager() {
        try { 
            Constructor<PreferenceManager> c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class);
            c.setAccessible(true);
            PreferenceManager preferenceManager = c.newInstance(this.getActivity(), FIRST_REQUEST_CODE);
            return preferenceManager;
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android PreferenceScreen Questions & Answers:

See Code Examples for Android PreferenceScreen Methods: