preference

how to hide the divider between preferences in fragment

人盡茶涼 提交于 2019-12-22 03:41:23
问题 I want to hide the divider between preferences in fragment. The code is below: 1.SettingsActivity.java public class SettingsActivity extends PreferenceActivity { super.onCreate(savedInstanceState); SettingsFragment settingsFragement = new SettingsFragment(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.add(android.R.id.content, settingsFragement, "settings"); transaction.commitAllowingStateLoss(); } 2.SettingsFragment.java public class

Custom DatePicker as Preference does not keep value when user edits value in field

天大地大妈咪最大 提交于 2019-12-20 10:48:25
问题 I created a DatePickerPreference, i.e. I extended DialogPreference and created a DatePicker object inside and had it working almost perfectly. It changes values when you click the arrows up and down and saves the value you select. However, if you click inside the field and types the new value there, it doesn't save the updated value! When using the arrows, the onDateChanged() method is always called; when user enters the field and edits it, it will only call onDateChanged if he selects

Can I perform database specific operation using android.preference package?

可紊 提交于 2019-12-20 03:14:53
问题 I need a database in which I can store data and get data whenever I need. Is this possible with android.preference package. I do not want to use sqlite database regards 回答1: According to Shared Preferences | Android Developer Tutorial (Part 13) by Sai Geetha M N, Many applications may provide a way to capture user preferences on the settings of a specific application or an activity. For supporting this, Android provides a simple set of APIs. Preferences are typically name value pairs. They

Android get view of Preference in PreferenceActivity

淺唱寂寞╮ 提交于 2019-12-19 05:35:37
问题 I would like to get View instance that is used to display specific Preference in my PreferenceActivity, so i can modify its properties, for example: public class SettingsActivity extends PreferenceActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference); Preference pref = findPreference("key"); pref.getView().setVisibility(View.GONE); //not necessarily setVisibility, i hope you get my point } } I only found

Android get view of Preference in PreferenceActivity

北慕城南 提交于 2019-12-19 05:35:32
问题 I would like to get View instance that is used to display specific Preference in my PreferenceActivity, so i can modify its properties, for example: public class SettingsActivity extends PreferenceActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference); Preference pref = findPreference("key"); pref.getView().setVisibility(View.GONE); //not necessarily setVisibility, i hope you get my point } } I only found

Android preference summary . How to set 3 lines in summary?

佐手、 提交于 2019-12-18 15:47:27
问题 Summary of preference is allowed only 2 lines . If I want to display 3 lines or more in summary . How can I do ? 回答1: You can create you Preference class by extending any existing preference: public class LongSummaryCheckboxPreference extends CheckboxPreference { public LongSummaryCheckboxPreference(Context ctx, AttributeSet attrs, int defStyle) { super(ctx, attrs, defStyle); } public LongSummaryCheckboxPreference(Context ctx, AttributeSet attrs) { super(ctx, attrs); } @Override protected

SharedPreferences will not save/load in PreferenceActivity

回眸只為那壹抹淺笑 提交于 2019-12-18 12:25:17
问题 EDIT: The problem described below was due to a very peculiar device issue not caused by any coding-related problem. I have a preferenceActivity in which I have many checkBoxPreferences. The checkBoxPreference is suppose to save the the default shared preferences file, and then be called again when I open the app in order to update the UI. This does not happen like it's suppose to. If I close the app and open it back up, my values remain like they are suppose to, but if I use task manager to

How to change the integrated terminal in visual studio code or VSCode

我们两清 提交于 2019-12-18 10:12:16
问题 I want to change integrated terminal to CMDER i use Vscode on windows 8.1 i checked the doc and also preference file but i got confuse so from following lines which line will change it // External Terminal // Customizes which terminal to run on Windows. "terminal.external.windowsExec": "%COMSPEC%", // Customizes which terminal application to run on OS X. "terminal.external.osxExec": "Terminal.app", // Customizes which terminal to run on Linux. "terminal.external.linuxExec": "xterm", //

Storing integers in preference class

烂漫一生 提交于 2019-12-18 09:51:16
问题 In my android app I have created a preference class(which extends PreferenceActivity) for storing about 10 integer values. I am not creating any xml file for that activity in R.xml as I don't want it. I just need to store 10 integer variables in this file(which can save it even after exit) and I want to get these values from another activity, perform some changes to the preferences, then save the preference class. My queries are: How can I store an integer variable in preference class? How to

Dynamic ListPreference in android

筅森魡賤 提交于 2019-12-17 10:19:35
问题 How to generate dynamic listPreference in android? I want to get all wifi access points and make a list using in preference Activity(i.e. make a list using listpreference). How to do this? 回答1: Every XML element in Android can be created programmatically as the element name is also a Java class. Hence you can create a ListPreference in code: CharSequence[] entries = { "One", "Two", "Three" }; CharSequence[] entryValues = { "1", "2", "3" }; ListPreference lp = new ListPreference(this); lp