preferences

An EditTextPreference with Minimum character requirement

我的梦境 提交于 2019-12-13 06:22:53
问题 I have an EditTextPreference that I user to allow use to set a passcode to an app. I want to require a 4-digit passcode. I set the maxLength = "4" in the xml file. Now I have the problem to not allow submit unless the entered passcode is 4 digits long. Here is what I have: <EditTextPreference android:defaultValue="" android:dependency="EnablePasscode" android:dialogMessage="Add a numeric passcode to provide access to enter the app. The passcode must be 4 digits." android:dialogTitle="Set

Preferences API working with multiple ClassLoaders?

旧城冷巷雨未停 提交于 2019-12-13 04:40:04
问题 i am currently working with the Preferences API to save settings in a Vaadin application. The application has 3 WebApps running on a Tomcat server. As i have learned, the Tomcat server has a ClassLoader for every module running on it but it is all running in one Virtual Machine. Can anybody explain to me why Java Preferences are working on multiple ClassLoaders? I cannot find any source for this and i didn't find anything by debugging. Thank you a lot. 回答1: I have found the answer: You get a

Android libgdx prefs getting lost

早过忘川 提交于 2019-12-12 19:24:24
问题 I've created Android game in Libgdx engine... After some time I've noticed that game options that I'm saving into prefs are lost after killing the app in some app killer, or if I do "Force Close" in Android Settings... Is there a way to prevent this? I've never done "Clear Data", just "Force close"... Is there a good alternative to prefs? Really weird problem... This is how I get and put values into prefs... /** Shared preferences */ public static final Preferences prefs = Gdx.app

Android: how do I call findPreference() from my main activity?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 13:41:35
问题 I'm handling the preferences screen for my Android app. I want to disable (grey it out) an item if the preceding one has a specific value. I have implemented two classes: MainActivity and PreferencesActivity. In MainActivity I do: public class MainActivity extends Activity implements OnSharedPreferenceChangeListener { ... public void onCreate (Bundle savedInstanceState) { ... sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); sharedPrefs

Is it possible to load ListPreference items from an adapter?

做~自己de王妃 提交于 2019-12-12 07:55:59
问题 I'm setting out to create a settings activity for my app. I've defined a PreferenceActivity with a nice layout including a ListPreference object for the user to select a bluetooth device. I'm having trouble dynamically populating the list . I would like to populate ListPreference with values from an array adapter (which I'll create and populate with relevant bluetooth device names). If this were a spinner View, I could just call setAdapter() . However with the ListPreference object I can't

Android Preferences error

风格不统一 提交于 2019-12-12 06:03:42
问题 In my app, I am trying to set up preferences that allows you to change the background image of a layout from a ton of choices in a ListPreference. My preferences xml: <PreferenceCategory android:title="Favorite Team"> <ListPreference android:title="Favorite Team" android:summary="@string/prefs_pick_fav_team" android:key="keyFavTeam" android:entries="@array/teams" android:entryValues="@array/teams_values" android:defaultValue="0" /> </PreferenceCategory> The PreferencesActivity, which is also

How do I capture changes of a CheckBoxPreference in android development?

隐身守侯 提交于 2019-12-12 04:15:35
问题 I'm trying to learn how to do live wallpapers for android. I've got it working and now I want to add a couple preferences. So, I've created a preference activity and followed all the examples I could find. I can capture ListBoxPreferences just fine, but the 'onSharedPreferenceChanged' method is never called when a checkbox has been changed. Is there extra code that has to be added for capturing checkbox changes? Is there a best practices way of doing check boxes in preferences? I've been

I'm trying to use Java Preferences from XML WITHOUT using Windows registry, but I see a Registry-related message

不问归期 提交于 2019-12-12 02:34:55
问题 I have a simplified program that produces the following output, in which the lines starting with ^ are generated by my code. Note that I deliberately deleted the Prefs key in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft. ^ A preferences file was found Aug 09, 2013 2:45:23 PM java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. ^ doallunconditionally: false ^

Custom PreferenceActivity Layout is lost for nested PreferenceScreens

二次信任 提交于 2019-12-12 02:34:45
问题 I have a preference activity which gets it's layout from the following XML. This makes a button appear at the bottom of the preferences. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/com.stealthcopter.nexus.nexusgl" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ListView android:id="@android:id/list" android:layout_weight="1" android:layout_width="fill_parent"

start activity custom preference android

旧城冷巷雨未停 提交于 2019-12-12 02:14:14
问题 I have a custom preference consisting of four imageViews. I want to start an activity when just the 4th of the 4 imageViews is clicked. public class ImagePreference4Locks extends Preference { public ImagePreference4Locks(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); this.setLayoutResource(R.layout.imagepref4locks); } @Override protected void onBindView(View view) {final Context m = this.getContext(); super.onBindView(view); final