Code example for PreferenceScreen

Methods: setSummarysetTitle, setEnabled

0
    } 
	 
	protected void enableToggles() 
    { 
    	install_u2nl.setEnabled(true);
    	install_sqlite3.setEnabled(true);
 
    } 
	 
    private class checkStatus extends AsyncTask<Void, Void, Boolean> 
	{ 
    	boolean u2nlStatus = false;
    	boolean sqlite3Status = false;
 
    	 
    	protected void onPreExecute() 
    	{ 
    		Log.d(TAG, "checking binary status");
    		setProgressBarIndeterminateVisibility(true);
    		disableToggles(); 
    	} 
    	 
    	@Override 
		protected Boolean doInBackground(final Void... params) 
		{ 
    		 
    		try { 
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			} 
 
    		u2nlStatus = u2nlExists();
    		sqlite3Status = sqlite3Exists();
 
    		 
			return true; 
		} 
    	 
    	protected void onPostExecute(Boolean state)
    	{ 
    		setProgressBarIndeterminateVisibility(false); 
        	install_u2nl.setTitle((u2nlStatus ? "Uninstall" : "Install")+" u2nl");
        	install_u2nl.setSummary((u2nlStatus ? "Uninstall" : "Install")+" the u2nl binary");
        	 
        	 
        	install_sqlite3.setTitle((sqlite3Status ? "Uninstall" : "Install")+" sqlite3");
        	install_sqlite3.setSummary((sqlite3Status ? "Uninstall" : "Install")+" the sqlite3 binary");
        	 
        	enableToggles(); 
    	} 
	}