本文整理匯總了Java中android.preference.MultiSelectListPreference.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiSelectListPreference.setEnabled方法的具體用法?Java MultiSelectListPreference.setEnabled怎麽用?Java MultiSelectListPreference.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.preference.MultiSelectListPreference
的用法示例。
在下文中一共展示了MultiSelectListPreference.setEnabled方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fillBuckets
import android.preference.MultiSelectListPreference; //導入方法依賴的package包/類
private void fillBuckets() {
this.bucketNames = PBApplication.getMediaStore().getBucketData();
final CharSequence[] ids = this.bucketNames.values().toArray(new CharSequence[this.bucketNames.size()]);
final CharSequence[] names = this.bucketNames.keySet().toArray(new CharSequence[this.bucketNames.size()]);
final MultiSelectListPreference bucketListPreference = (MultiSelectListPreference) findPreference(PBConstants.PREF_PICTURE_FOLDER_LIST);
bucketListPreference.setEntries(ids);
bucketListPreference.setEnabled(true);
bucketListPreference.setEntryValues(names);
setSummaries();
}
示例2: setCountries
import android.preference.MultiSelectListPreference; //導入方法依賴的package包/類
private void setCountries()
{
AsyncTask<String, Integer, List<Map<String, Object>>> requestTask =
new AsyncTask<String, Integer, List<Map<String, Object>>>()
{
@Override
protected List<Map<String, Object>> doInBackground(String... params)
{
ServerComms comms = new ServerComms();
String content = "";
try
{
content = comms.getRequest(params[0]);
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return comms.parseJsonList(content);
}
protected void onPostExecute(List<Map<String, Object>> countries)
{
List<String> countryList = new ArrayList<String>();
for (Map<String, Object> country : countries)
{
countryList.add((String)country.get("name"));
}
CountryPrefs.this.countries = countryList;
PreferenceScreen root = CountryPrefs.this.getPreferenceScreen();
MultiSelectListPreference list =
(MultiSelectListPreference) root.findPreference("countries");
list.setEntries(countryList.toArray(new String[]{}));
list.setEntryValues(countryList.toArray(new String[]{}));
list.setEnabled(true);
Log.i(TAG, "Got country list with " + countryList.size() + " entries.");
Log.i(TAG, "First entry is " + countryList.get(0));
}
};
requestTask.execute("http://fcoalerts.herokuapp.com/countries.json");
}
示例3: bindPreferenceSummaryToValue
import android.preference.MultiSelectListPreference; //導入方法依賴的package包/類
private static void bindPreferenceSummaryToValue(MultiSelectListPreference preference,
List<Account> accounts) {
int len = accounts.size();
CharSequence[] entries = new CharSequence[len];
CharSequence[] entryValues = new CharSequence[len];
Set<String> defaultValue = new HashSet<String>();
Set<String> savedUuids = PreferenceManager.getDefaultSharedPreferences(
preference.getContext()).getStringSet(preference.getKey(), null);
// Populate MultiSelectListPreference with entries for all available accounts
int i = 0;
for (Account account : accounts) {
defaultValue.add(account.uuid);
entries[i] = account.name;
entryValues[i] = account.uuid;
i++;
}
preference.setEntries(entries);
preference.setEntryValues(entryValues);
// Check currently selected accounts
Set<String> selectedAccounts;
if (savedUuids == null) {
// Select all accounts if there was no saved configuration
selectedAccounts = defaultValue;
} else {
// Clear out accounts that no longer exist
selectedAccounts = new HashSet<String>(savedUuids);
for (Iterator<String> iter = selectedAccounts.iterator(); iter.hasNext(); ) {
String accountUuid = iter.next();
if (!defaultValue.contains(accountUuid)) {
iter.remove();
}
}
}
preference.setValues(selectedAccounts);
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, selectedAccounts);
preference.setEnabled(true);
}