preferences

What method is called when PreferenceActivity saves values

自作多情 提交于 2019-12-12 01:39:12
问题 I have an app which uses PreferenceActivity to define time period to run scheduled tasks. But I can't the right method to Override in PreferenceActivity to make tasks rescheduled on period values changed. Does anyone know what method is called when PreferenceActivity saves values? I am using API 8 level and seems that onSaveInstanceState(Bundle outState) is not that I am looking for. 回答1: There is no callback for changed preferences in a PreferenceActivity. But you can use the normal

Mac .pref File Hex Path

久未见 提交于 2019-12-11 22:24:13
问题 I'm trying to enter a file path into a few .pref files, but instead of a String, the field wants some sort of Hexadecimal sequence. How can I convert my path into this Hex format? Mac OS 10.6.7 Here is an example of a file location: <00000000 009e0003 00010000 c94bbb14 0000482b 00000000 000d3ad2 000dfc12 0000c950 e4db0000 00000920 fffe0000 00000000 0000ffff ffff0001 0008000d 3ad2000c 9ce1000e 000c0005 0069006e 0062006f 0078000f 001a000c 004d0061 00630069 006e0074 006f0073 00680020 00480044

Make brackets automatic start new line

心已入冬 提交于 2019-12-11 14:14:23
问题 Sorry if I was not able to describe in the title how I like to do; I know that in AndroidStudio there is a way to use this brackets notation protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } instead this protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } In other words I like that the first bracket of any method, class etc starts a

Preference with icon not showing in ICS+

烂漫一生 提交于 2019-12-11 12:37:02
问题 I am using the IconPreferenceScreen class found here to create a preference list with a delete icon on the right. This is the code I have used: protected void updateFavoritesCategory() { PreferenceCategory favsCategory = (PreferenceCategory) findPreference("pref_category_favs"); favsCategory.removeAll(); List<Favorite> favs = myAppDB.getFavorites(); for (Favorite f : favs) { String stName = StringUtils.unescapeHTML(f.getName()); stName = URLDecoder.decode(stName); IconPreferenceScreen

Set System Preferences using Objective-C

江枫思渺然 提交于 2019-12-11 11:08:31
问题 This is probably trivial, however I couldn't find any information online: How can I set any Apple preference using code? I would like to create a little application for myself that sets certain preferences when I click a button. For instance I would like to turn off Bluetooth and Wi-Fi. As far as I know, these preferences are stored in /Users/fabian/Library/Preferences/com.apple.*.plist . So: how can I change these preferences and make sure they are applied? 回答1: The CoreFoundation

Show a Toast when user change setting in preferences activity

*爱你&永不变心* 提交于 2019-12-11 08:17:13
问题 I have a preferences Activity with a ListPreference on it and I use this preferences in another activity, But I want to show a Toast whenever, user changing option in preference Activity. For example, when user clicks on second radio button in ListPreference, suddenly a toast shown and says "second". 回答1: What is the problem? Resolve the preference and set a listener that does the toast? Something like this for example ListPreference listPreference = findPreference(key); listPreference

How to get the sumary from preferences

丶灬走出姿态 提交于 2019-12-11 08:17:12
问题 One question: I have a EditTextPreference to let the user type in a default path for the app. How can I manage that the new value is to be seen in the preferencefragment I use? After the user clicked ok in the preference window to complete the new settings I want to write the new path as a summary below the title. I have tried already experiencing with the onSharedPreferenceChanged but it did not work. I do not know how to get access to the edit field from the popup window where the users

Building Preference screen in code depending on another setting

拥有回忆 提交于 2019-12-11 07:51:49
问题 I have searched here and looked at samples but haven't yet found an answer to what is essentially a simple problem. Depending on the choice made in a preceding ListPreference, I want to build a preference screen of CheckBoxPreferences dynamically in code, which is then shown when I click on a simple preference with a click listener. The list and number of check boxes will be different in each case. This is where I have got to so far - just a simple bit of code to test the concept in the

Android: subclassing DialogPreference

末鹿安然 提交于 2019-12-11 07:25:17
问题 I am trying to create custom dialog preference that will hold radio group with two radio buttons and one edittext. If I write something like <DialogPreference android:title="preftitle" android:dialogLayout="@layout/preflayout" android:summary="pref summary" android:key="prefkey" android:defaultValue="defaultValue" /> the application breaks when trying to create PreferenceActivity that holds this dialog preference. I guess I have to subclass DialogPreference and put that subclass as xml

using preferences — my listview is empty (can't store data)

[亡魂溺海] 提交于 2019-12-11 06:56:55
问题 I need help in order to properly set up preferences. I have my main activity from which by pressing the menu button ,i am going to the preferences activity.There,i have 3 entries where the user inputs his data.The first entry is a serial number. I want to be able to show a list with all the serial numbers and when the user selects one,show him the other entries (or do some calculations ). ----------UPDATED------------------------------------ My main activity is: public class Strength extends