preferenceactivity

Android: Mangled PreferenceActivity view

I have pretty unassuming preferences screen based on PreferenceActivity. (You can see it in DroidIn app) I'm having some problems with it that I think have to do with redrawing the screen after updates. Here are the symptoms: OnPreferenceChangeListener#onPreferenceChange if I change summary of the preference by doing Preference#setSumm...

PreferenceActivity NullPointer Error

I keep getting nullpointer exception when i switch to my preferenceactivity. I have no idea what wrong but i keep getting a error when i load in my preference which is done programmitically. public class SettingsFrontEnd extends PreferenceActivity implements OnSharedPreferenceChangeListener { public static final String NO_SELECTION...

How do I get the SharedPreferences from a PreferenceActivity in Android?

Hi, I am using a PreferenceActivity to show some settings for my application. I am inflating the settings via a xml file so that my onCreate (and complete class methods) looks like this: public class FooActivity extends PreferenceActivity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFr...

Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen

I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title. PreferenceScreen root = mgr.createPreferenceScreen(this); for (MyAccountClass account : myAccounts) { final PreferenceScreen accScreen = mgr.createPreferenceScreen(this)...

Responding to preference updates in Android

I am calling a PreferenceActivity from another activity and then updating the application state (ie: changing the font size) on onActivityResult, based on the preference changes. I was thinking it would be better to put the state update logic in the PreferenceActivity. That way I don't have the duplicate the logic in each activity that ...

Failed to start my preference activity

Hi, Currently I am trying to add a preference activity into my application but found out that I couldn't make it works. Every time, I tried to start the preference activity but it just crash before showing anything. Here is the manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/...

Number Preferences in Preference Activity in Android

Hello, What I want to do is I am working on a game of life program. I want to take the time delay and make it a preference, but I want to make it available for people to type in a specific time. The number can be in miliseconds or seconds. However I'm a little stuck on how to proceed, I haven't been able to find a simple preference...

Android PreferenceActivity instance.

How can I find my PreferenceActivity instance, which was created by a framework? * * * My first class. /** This is MyAppSettings class, The instance of this class will be created by a framework **/ public class MyAppSettings extends PreferenceActivity { protected MySeekBarPreference mSeekBarPref; @Override protected void...

Android Preferences Add Values from Database

One of the Preferences in my PreferenceActivity needs to get its values from a database. How do I add these values? public class Settings extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_scr...

Loading in preferences only on ititial launch or user has just visited PreferenceActivity

I'm working on a live wallpaper and I would like to load in my shared_preferences file only when the wallpaper is first set or when the user visits my PreferenceActivty. I'm currently loading in my preferences in onVisibilityChanged() of my WallpaperEngine() class. Is there a place that makes more sense? The reason I don't want to loa...

How to display defaultValues the first time a PreferenceActivity is started?

I've defined my preferences in an xml file, preferences.xml. I've also got a SettingsWindow class which extends PreferenceActivity. I've set the android:defaultValue attribute on my preferences in the xml file but they don't appear the first time the app is launched. How do I load the default values defined in the xml file into the Setti...

Displaying ProgressDialog within a PreferenceActivity

I've got a quite interesting issue when I try to display a ProgressDialog (the simple, spinner type) within a onPreferenceChange listener. public class SettingsActivity extends PreferenceActivity { private ProgressDialog dialog; public void onCreate(Bundle savedInstanceState) { ListPreference pref= (ListPreference) findPreferen...

Can't access preferences created by PreferenceActivity

I have a minimal program that does little more than let me set two preferences (an int and a String) using Android's PreferenceActivity. So I have an xml file that defines my preferences, and an activity that extends PreferenceActivity. My main activity has an options menu that launches my preference activity. All of that works great. I ...

Android PreferenceActivity to create a MODE_WORLD_WRITEABLE preference across applications

Hi, I have multiple applications that share certain data through preferences. Each app sets its preferences through a PreferenceActitivity (from xml). Two questions: How do I use/edit preferences created by one app in another app. If I figure out how to create MODE_WORLD_WRITEABLE preferences using PreferenceActivity that will solve t...

Toast in PreferenceActivity is shown late.

I want to show a Toast right after the user clicks on a CheckBoxPreference in my PreferenceActivity. myCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Toast.makeText(Prefs.this, "tes...

Android: PreferenceActivity: Why is this 'simple' logic check on a stored preference value not evaluating?

Following an example from Professional Android 2 Application Development I set up a pref class as follows: //Preferences.java public class Preferences extends PreferenceActivity{ public static final String PREF_SPEED_UNIT ="PREF_SPEED_UNIT"; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(sa...

Override click in android preferenceactivity

Hi everyone, In my app I'd like to show a warning when using a certain preference in my application. I've tried using the PreferenceActivity.onPreferenceTreeClick and the onPreferenceClickListener, but neither seems to work. I've got the latter example below. Could anyone shed some light on this please? @Override protected void onCreat...

PreferenceActivity: save value as integer

Using a simple EditTextPreference in my preferences activity: <EditTextPreference android:key="SomeKey" android:title="@string/some_title" android:summary="..." android:numeric="integer" android:maxLength="2" /> Is there a way that this configuration value would be saved as integer? Seems now it just allows to ente...

Android: How to use Buttons in Preference Screen

I'd like to provide a Button in the PreferenceActivity. The user should be able to set a time (e.g. via TimePicker), but there's no ButtonPreference or something like that. I don't want to use EditTextPreference. So do I have to use a default Button in the PreferenceActivity and save the settings for it manually? Regards, cody ...

[Android] Binding EditTextPreference to a given preference file (getSharedPreferences)

Hi, two activities here, A and B. A is main, B is PreferenceActivity with two EditTextPreference. I want to be able to access the preferences generated by B from activity A, and for that I need of course (I guess) getSharedPreferences on A. But in order to do that I need to supply the preference file for the activity that generated it. ...