List of usage examples for android.preference CheckBoxPreference CheckBoxPreference
public CheckBoxPreference(Context context, AttributeSet attrs)
From source file:com.adam.aslfms.MusicAppsActivity.java
private void update() { mSupportedMusicAppsList.removeAll(); mPrefsToMapisMap.clear();//w w w.j a v a 2s . c om mMapisToPrefsMap.clear(); MusicAPI[] mapis = MusicAPI.all(this); for (MusicAPI mapi : mapis) { CheckBoxPreference appPref = new CheckBoxPreference(this, null); appPref.setTitle(mapi.getName()); appPref.setPersistent(false); appPref.setChecked(mapi.isEnabled()); mSupportedMusicAppsList.addPreference(appPref); mPrefsToMapisMap.put(appPref, mapi); mMapisToPrefsMap.put(mapi, appPref); setSMASummary(appPref, mapi); } // explanation text, for what this screen does Preference detect = new Preference(this); if (mapis.length == 0) detect.setTitle(R.string.no_supported_mapis_title); else if (mapis.length == 1) detect.setTitle(R.string.find_supported_mapis_one_title); else detect.setTitle(getString(R.string.find_supported_mapis_many_title).replace("%1", Integer.toString(mapis.length))); detect.setSummary(R.string.find_supported_mapis_summary); mSupportedMusicAppsList.addPreference(detect); }