preference

Android Checkbox preference

时间秒杀一切 提交于 2019-11-29 20:19:23
I cannot find any tutorials on checkbox preference. I can use a listpreference, but I can't use checkbox preference. For now, I want that if user sets on the checbox, a toast msg says "true" and if he sets it off, the toast msg says "false". So far I have this: preferences.xml: <CheckBoxPreference android:title="Show Call UI" android:defaultValue="true" android:summary="Show Call Interface when clicking call button" android:key="checkboxPref" /> EditPreferences.java: public class EditPreferences extends PreferenceActivity { String listPreference; boolean checkboxPreference; @Override public

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

北战南征 提交于 2019-11-29 20:16:14
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", // Integrated Terminal // The path of the shell that the terminal uses on Linux. "terminal.integrated.shell

Storing integers in preference class

旧街凉风 提交于 2019-11-29 18:14:59
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 call that variable from another activity? How to return that variable again to preference class? Hi

PreferenceFragment background color

本秂侑毒 提交于 2019-11-29 16:23:45
问题 I am using a PreferenceFragment (without a ListView ), but am unable to set the background color, and it seems to be transparent. How can I set the background color to white with PreferenceFragment ? EDIT: first screenshot: Overriding onCreateView not work - 回答1: This question was also answered here Adding the following code to your PreferenceFragment will let you add a background color, image, etc. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

Define Default Activity (when app starts) programmatically

大兔子大兔子 提交于 2019-11-28 21:58:38
My application is composed by a few activity. Activity A is my main menu with some icons. This Activity can launch depending on which icon you press: Activity B,C,D,E or F. That's fine and really easy, Activity A is the default one. Now, I made an option in preference that allow users to start their favourite activity. Some users will in fact prefer to get directly Activity B for instance. The only way I found a solution was to do this in Activity A This solution is very ugly because Activity A will always launch and close automatically: public void onCreate(Bundle savedInstanceState) { super

Android Checkbox preference

六月ゝ 毕业季﹏ 提交于 2019-11-28 16:19:09
问题 I cannot find any tutorials on checkbox preference. I can use a listpreference, but I can't use checkbox preference. For now, I want that if user sets on the checbox, a toast msg says "true" and if he sets it off, the toast msg says "false". So far I have this: preferences.xml: <CheckBoxPreference android:title="Show Call UI" android:defaultValue="true" android:summary="Show Call Interface when clicking call button" android:key="checkboxPref" /> EditPreferences.java: public class

How to set the Default Value of a ListPreference

£可爱£侵袭症+ 提交于 2019-11-28 09:35:05
i need to set the defult value for a ListPreference when the Activity starts. I've tried with ListPreference.setDefaultvalue("value"); but it makes the firts Entry of the List as default. I need it because i must check a condition and set as default the value which satisfies that condition, so I think it can't be done from the xml file (with android:defaultValue ) For example, suppose I have this array of values in the arrays.xml: <string-array name="opts"> <item>red</item> <item>green</item> <item>blue</item> </string-array> <string-array name="opts_values"> <item>1</item> <item>2</item>

Android shared preferences not saving

时光怂恿深爱的人放手 提交于 2019-11-28 07:11:50
I've created an Android live wallpaper and i'm trying to let a user choose an image from their phone and apply it as a background image, but when I launch the activity that start the intent to pick the images, my shared preferences don't seem to save properly. Below is my onCreate method of the activity I start when the users presses the preference button, and the onActivityResult which gets the path of the image on the device (all that seems to work). The println after I commit the preferences prints out nothing. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Android: How to adjust Margin/Padding in Preference?

强颜欢笑 提交于 2019-11-28 06:57:31
Before I asked to remove the padding of the PreferenceActivity/PreferenceFragment: Android: How to maximize PreferenceFragment width (or get rid of margin)? This time I having trouble adjusting margin/padding before Title Text. (See image below). Does anybody have any idea? You could customize you checkbox like this: MyPreference.xml <CheckBoxPreference android:key="testcheckbox" android:title="Checkbox Title" android:summary="Checkbox Summary..." android:layout="@layout/custom_checkbox_preference_layout"> </CheckBoxPreference> and custom_checkbox_preference_layout.xml <?xml version="1.0"

Android SeekBarPreference

十年热恋 提交于 2019-11-28 01:14:09
I'm currently trying to implement SeekBarPreference class using http://android-journey.blogspot.com/2010/01/for-almost-any-application-we-need-to.html tutorial with RelativeLayout. First problem is TextView preferenceText isn't showing at all. Second problem is the bar can't be slided like those in regular preferences (like media volume bar)? public class SeekBarPreference extends Preference implements OnSeekBarChangeListener { public static int maximum = 100; public static int interval = 5; private float oldValue = 25; private TextView Indicator; public SeekBarPreference(Context context) {