当前位置: 首页>>代码示例>>Java>>正文


Java ListPreference.getEntry方法代码示例

本文整理汇总了Java中android.preference.ListPreference.getEntry方法的典型用法代码示例。如果您正苦于以下问题:Java ListPreference.getEntry方法的具体用法?Java ListPreference.getEntry怎么用?Java ListPreference.getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.ListPreference的用法示例。


在下文中一共展示了ListPreference.getEntry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updatePref

import android.preference.ListPreference; //导入方法依赖的package包/类
/**
 * Update a preference
 * @param key - which preference
 */
private void updatePref(String key){
    ListPreference preference = (ListPreference) findPreference(key);
    CharSequence entry = preference.getEntry();
    String value = preference.getValue();
    preference.setSummary(entry);
    SharedPreferences.Editor editor = mPreferences.edit();
    // Fucking strangely, a string cannot be parsed to an integer
    editor.putString(key, value);
    editor.apply();
}
 
开发者ID:iskandergaba,项目名称:Botanist,代码行数:15,代码来源:SettingsActivity.java

示例2: setListFieldSummary

import android.preference.ListPreference; //导入方法依赖的package包/类
/**
 * Set summary of a list field If empty will display default summary If one
 * item selected will display item name
 * 
 * @param fieldName the preference key name
 */
public void setListFieldSummary(String fieldName) {
    PreferenceScreen pfs = getPreferenceScreen();
    ListPreference pref = (ListPreference) pfs.findPreference(fieldName);
    if (pref == null) {
        Log.w(THIS_FILE, "Unable to find preference " + fieldName);
        return;
    }

    CharSequence val = pref.getEntry();
    if (TextUtils.isEmpty(val)) {
        val = getDefaultFieldSummary(fieldName);
    }
    setPreferenceSummary(pref, val);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:21,代码来源:GenericPrefs.java

示例3: prepareListPreference

import android.preference.ListPreference; //导入方法依赖的package包/类
private void prepareListPreference(final ListPreference listPreference)
{
    if (listPreference == null)
    {
        return;
    }

    if (listPreference.getValue() == null)
    {
        // to ensure we don't get a null value
        // set first value by default
        listPreference.setValueIndex(0);
    }

    if (listPreference.getEntry() != null)
    {
        listPreference.setSummary(listPreference.getEntry().toString());
    }
    listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
    {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue)
        {
            listPreference.setValue(newValue.toString());
            preference.setSummary(listPreference.getEntry().toString());
            return true;
        }
    });
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:30,代码来源:SettingsActivity.java

示例4: onSharedPreferenceAudioSourceChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceAudioSourceChanged()
{
	try
	{
		Preference preferencesAudioSource = findPreference("preferences_audio_source");
		if (preferencesAudioSource instanceof ListPreference)
		{
			ListPreference listPreferencesAudioSource = (ListPreference) preferencesAudioSource;
			preferencesAudioSourceValue = (String) listPreferencesAudioSource.getEntry();
			preferencesAudioSource.setSummary(getString(R.string.preferences_audio_source_summary) + " " + listPreferencesAudioSource.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceAudioSourceChanged : " + getApplicationContext().getString(R.string.log_preferences_audio_source_changed) + " : " + listPreferencesAudioSource.getEntry());
			
			if(isInit == true)
			{	
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_audio_source_changed) + " : " + listPreferencesAudioSource.getEntry(), new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceAudioSourceChanged : " + getApplicationContext().getString(R.string.log_preferences_error_audio_source_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_audio_source_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Preferences.java

示例5: onSharedPreferenceAudioFormatChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceAudioFormatChanged()
{
	try
	{
		Preference preferencesAudioFormat = findPreference("preferences_audio_format");
		if (preferencesAudioFormat instanceof ListPreference)
		{
			ListPreference listPreferencesAudioFormat = (ListPreference) preferencesAudioFormat;
			preferencesAudioFormatValue = (String) listPreferencesAudioFormat.getEntry();
			preferencesAudioFormat.setSummary(getString(R.string.preferences_audio_format_summary) + " " + listPreferencesAudioFormat.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceAudioFormatChanged : " + getApplicationContext().getString(R.string.log_preferences_audio_format_changed) + " : " + listPreferencesAudioFormat.getEntry());
			
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_audio_format_changed) + " : " + listPreferencesAudioFormat.getEntry(), new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceAudioFormatChanged : " + getApplicationContext().getString(R.string.log_preferences_error_audio_format_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_audio_format_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Preferences.java

示例6: onSharedPreferenceReplayerVisualizerChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceReplayerVisualizerChanged()
{
	try
	{
		Preference preferencesReplayerVisualizer = findPreference("preferences_replayer_visualizer");
		if (preferencesReplayerVisualizer instanceof ListPreference)
		{
			ListPreference listPreferencesReplayerVisualizer = (ListPreference) preferencesReplayerVisualizer;
			preferencesReplayerVisualizerValue = (String) listPreferencesReplayerVisualizer.getEntry();
			preferencesReplayerVisualizer.setSummary(getString(R.string.preferences_replayer_visualizer_summary) + " " + listPreferencesReplayerVisualizer.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceReplayerVisualizerChanged : " + getApplicationContext().getString(R.string.log_preferences_replayer_visualizer_changed) + " : " + listPreferencesReplayerVisualizer.getEntry());
			
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_replayer_visualizer_changed) + " : " + listPreferencesReplayerVisualizer.getEntry(), new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceReplayerVisualizerChanged : " + getApplicationContext().getString(R.string.log_preferences_error_replayer_visualizer_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_replayer_visualizer_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Preferences.java

示例7: onSharedPreferencePurgeFrequencyChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferencePurgeFrequencyChanged()
{
	try
	{
		Preference preferencesPurgeFrequency = findPreference("preferences_purge_frequency");
		if (preferencesPurgeFrequency instanceof ListPreference)
		{
			ListPreference listPreferencesPurgeFrequency = (ListPreference) preferencesPurgeFrequency;
			preferencesPurgeFrequencyValue = (String) listPreferencesPurgeFrequency.getEntry();
			preferencesPurgeFrequency.setSummary(getString(R.string.preferences_purge_frequency_summary) + " " + listPreferencesPurgeFrequency.getEntry());
			
			Log.d("Preferences", "onSharedPreferencePurgeFrequencyChanged : " + getApplicationContext().getString(R.string.log_preferences_purge_frequency_changed) + " : " + listPreferencesPurgeFrequency.getEntry());
			
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_purge_frequency_changed) + " : " + listPreferencesPurgeFrequency.getEntry(), new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferencePurgeFrequencyChanged : " + getApplicationContext().getString(R.string.log_preferences_error_purge_frequency_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_purge_frequency_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Preferences.java

示例8: onSharedPreferencePurgeRetentionChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferencePurgeRetentionChanged()
{
	try
	{
		Preference preferencesPurgeRetention = findPreference("preferences_purge_retention");
		if (preferencesPurgeRetention instanceof ListPreference)
		{
			ListPreference listPreferencesPurgeRetention = (ListPreference) preferencesPurgeRetention;
			preferencesPurgeRetentionValue = (String) listPreferencesPurgeRetention.getEntry();
			preferencesPurgeRetention.setSummary(getString(R.string.preferences_purge_retention_summary) + " " + listPreferencesPurgeRetention.getEntry());
			
			Log.d("Preferences", "onSharedPreferencePurgeRetentionChanged : " + getApplicationContext().getString(R.string.log_preferences_purge_retention_changed) + " : " + listPreferencesPurgeRetention.getEntry());
			
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_purge_retention_changed) + " : " + listPreferencesPurgeRetention.getEntry(), new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferencePurgeRetentionChanged : " + getApplicationContext().getString(R.string.log_preferences_error_purge_retention_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_purge_retention_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Preferences.java

示例9: onSharedPreferenceLocaleSetChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceLocaleSetChanged()
{
	try
	{
		Preference preferencesLocaleSet = findPreference("preferences_locale_set");
		if (preferencesLocaleSet instanceof ListPreference)
		{
			ListPreference listPreferencesLocaleSet = (ListPreference) preferencesLocaleSet;
			preferencesLocaleSetValue = (String) listPreferencesLocaleSet.getEntry();
			preferencesLocaleSet.setSummary(getString(R.string.preferences_locale_set_summary) + " " + listPreferencesLocaleSet.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceLocaleSetChanged : " + getApplicationContext().getString(R.string.log_preferences_theme_set_changed) + " : " + listPreferencesLocaleSet.getEntry());
							
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_locale_set_changed) + " : " + listPreferencesLocaleSet.getEntry(), new Date().getTime(), 3, false);
				
				localizerManager.setPreferencesLocale(getApplicationContext());
				
				Intent restartApplicationIntent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				finish();
				startActivity(restartApplicationIntent);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceLocaleSetChanged : " + getApplicationContext().getString(R.string.log_preferences_error_locale_set_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_locale_set_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:38,代码来源:Preferences.java

示例10: onSharedPreferenceThemeSetChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceThemeSetChanged()
{
	try
	{
		Preference preferencesThemeSet = findPreference("preferences_theme_set");
		if (preferencesThemeSet instanceof ListPreference)
		{
			ListPreference listPreferencesThemeSet = (ListPreference) preferencesThemeSet;
			preferencesThemeSetValue = (String) listPreferencesThemeSet.getEntry();
			preferencesThemeSet.setSummary(getString(R.string.preferences_theme_set_summary) + " " + listPreferencesThemeSet.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceThemeSetChanged : " + getApplicationContext().getString(R.string.log_preferences_theme_set_changed) + " : " + listPreferencesThemeSet.getEntry());
							
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_theme_set_changed) + " : " + listPreferencesThemeSet.getEntry(), new Date().getTime(), 3, false);
			
				Intent restartApplicationIntent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				finish();
				startActivity(restartApplicationIntent);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceThemeSetChanged : " + getApplicationContext().getString(R.string.log_preferences_error_theme_set_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_theme_set_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:36,代码来源:Preferences.java

示例11: onSharedPreferenceColorThemeSetChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedPreferenceColorThemeSetChanged()
{
	try
	{
		Preference preferencesColorThemeSet = findPreference("preferences_color_theme_set");
		if (preferencesColorThemeSet instanceof ListPreference)
		{
			ListPreference listPreferencesColorThemeSet = (ListPreference) preferencesColorThemeSet;
			preferencesColorThemeSetValue = (String) listPreferencesColorThemeSet.getEntry();
			preferencesColorThemeSet.setSummary(getString(R.string.preferences_color_theme_set_summary) + " " + listPreferencesColorThemeSet.getEntry());
			
			Log.d("Preferences", "onSharedPreferenceColorThemeSetChanged : " + getApplicationContext().getString(R.string.log_preferences_color_theme_set_changed) + " : " + listPreferencesColorThemeSet.getEntry());
							
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_color_theme_set_changed) + " : " + listPreferencesColorThemeSet.getEntry(), new Date().getTime(), 3, false);
			
				Intent restartApplicationIntent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				restartApplicationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				finish();
				startActivity(restartApplicationIntent);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedPreferenceColorThemeSetChanged : " + getApplicationContext().getString(R.string.log_preferences_error_color_theme_set_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_color_theme_set_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:36,代码来源:Preferences.java

示例12: onSharedStoragePathChanged

import android.preference.ListPreference; //导入方法依赖的package包/类
private void onSharedStoragePathChanged()
{
	try
	{
		Preference preferencesStoragePath = findPreference("preferences_storage_path");
		if (preferencesStoragePath instanceof ListPreference)
		{
			ListPreference listPreferencesStoragePath = (ListPreference) preferencesStoragePath;
			if(listPreferencesStoragePath.getEntry() == null)
			{
				if (Environment.getExternalStorageState() != null)
				{
					preferencesStoragePathValue = String.valueOf(Environment.getExternalStorageDirectory());
				}
				else
				{
					preferencesStoragePathValue = "";
				}
				
				preferencesStoragePath.setSummary(getString(R.string.preferences_storage_path_summary) + " " + preferencesStoragePathValue);
			}
			else
			{
				preferencesStoragePathValue = (String) listPreferencesStoragePath.getEntry();
				preferencesStoragePath.setSummary(getString(R.string.preferences_storage_path_summary) + " " + listPreferencesStoragePath.getEntry());
			}
			
			SharedPreferences sharedPreferencesStoragePathValue = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
			SharedPreferences.Editor sharedPreferencesEditor = sharedPreferencesStoragePathValue.edit();
   			sharedPreferencesEditor.putString("preferences_storage_path_value", preferencesStoragePathValue);
   			sharedPreferencesEditor.commit();
			
			Log.d("Preferences", "onSharedStoragePathChanged : " + getApplicationContext().getString(R.string.log_preferences_storage_path_changed) + " : " + preferencesStoragePathValue);
			
			if(isInit == true)
			{
				databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_storage_path_changed) + " : " + preferencesStoragePathValue, new Date().getTime(), 3, false);
			}
		}
	}
	catch (Exception e)
	{
		Log.w("Preferences", "onSharedStoragePathChanged : " + getApplicationContext().getString(R.string.log_preferences_error_storage_path_changed) + " : " + e);
		
		if(isInit == true)
		{
			databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_preferences_error_storage_path_changed), new Date().getTime(), 2, false);
		}
	}
}
 
开发者ID:vassela,项目名称:AC2RD,代码行数:51,代码来源:Preferences.java


注:本文中的android.preference.ListPreference.getEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。