android-preferences

Force close message when preferences are called via menu button

I see no problem in the code. Help? preferences.xml <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; <ListPreference android:title="Gender" android:summary="Are you male or female?" android:key="genderPref" android:defaultValue="male" android:entries="@array/gende...

Android ==> Preference ???

my app crashes with a null pointer exception on the code below. i have an xml preference file under res/xml/defaults.xml Any idea why it's crashing? public class Preference extends Activity { public Preference() { } public String getPreference(String key) { //it still crashes here SharedP...

not getting the result using SharedPreferences in android

i am trying to store the user preference of whether the checkbox is clicked or not in an Activity , but when i shutdown and restart the app, i don't get the desired result . i.e if the user had checked the checkbox then on restarting i am not getting it as checked. here's what i have tried: public void onCreate() { .... checkbox=(C...

setcurrenttab from preference

The default tab that is displayed in my app is tab 0. I would like when Preference uso is clicked, to change the currentTab to 1, as well as the next time the app opens, tab 1 is displayed instead of tab 0. This is the Preferences.java contents: package com.fbisoft.uowt; import android.os.Bundle; import android.preference.Preference;...

Android Preferences: Unlimited, extensible value-list

Hello, I would like to allow the user to enter (a non-predetermined amount of) values for an Android application preference. Existing examples that come to mind are the alarm clock applications found on various smartphones (iPhone, HTC Android, ...) where the user can add an alarm clock time.* Can anyone think of a simple way to presen...

Calling PICK_CONTACT Intent not from an Activity

So I can display Android's contact selecton activity by calling startActivityForResult(intent, PICK_CONTACT); and i can get the selected contact by overriding onActivityResult public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); } Trouble is onActivityRes...

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...

Individual Preferences for each item in a ListView?

Hi everyone, I'm creating my first android app (or attempting to anyway) and i have a question i can't seem to find the answer to. I would like to allow users to enter a separate set of preferences for each item in a list view. I have the PreferenceScreen working, but it maintains the same preferences for every item (i.e. changing 1 i...

Android store array in preferences

I know only primitives can be stored in the android preferences, but do arrays count? Can I store an array of, say, Strings or booleans in an android preference? ...

About SharedPreferences in android

Hello, i was just wondering, if i wanted to reset the actual preference file used with SharedPreferences could i just rename the preference file ? , wouldn't that mean that the file still exist or does overwrite it ? ...

Use PreferenceActivity and save preferences in ContentProvider, how?

Hello, Jeff Sharkey in this post (http://goo.gl/G3wt) shows how to create save application preferences in database by hack on PreferenceActivity. It said i can use a ContentProvider, too. Can you give me an example on how to save preferences from PreferenceActivity to ContentProvider? thanks ...

How to mock PreferenceManager in Android?

I've written a class that is using Context, third party library and SharedPreferences from PreferenceManager. It's possible to mock Context, third party library can be mocked using some mocking framework, but what to do with PreferenceManager? I have two methods: public void saveString(ThirdPartyObject obj) { SharedPrefer...

Emulate android preference category look/feel

hello, i like title bar style in android preference category. In my activity (no preferenceactivity) i want to use same style, how i can do? Thanks. ...

Android HorizontalScrollView as a Preference?

Hi everyone, I've been having a tough time working with HorizontalScrollView's as a custom Preference. My overall goal is to make a scrollable series of dynamically included images that the user can chose. The chosen image will be used later, and thus needs to be a Preference (or at least that is how I think it should be implemented). Ha...

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...

[Android]How to get results from intent launched from preference screen?

Hi! I need help in geting results back from intent launched from preference screen // Intent preference DevicePref = getPreferenceManager().createPreferenceScreen(this); // Show a Screen with list of Devices Discovered Intent i = new Intent(this,getDevice.class); DevicePref.setIntent(i); DevicePref.setTitl...

How to put Preference into a View?

I need to make a Screen with Header(Will contain ImageView and TextView) and Footer(Navigation Menu, will consists of ImageView), in the between I need to have Preference screen with all the default action like scrolling and setting preferences. Which approach should I take to achieve this? Right now, I have made a View with FrameLayou...

Easy way to make the ListPreference multiple choice in Android?

I am trying to create a preference dialog window that allows the user to select more then one item in the list. Currently it only allows you to select one item. Is there an easy way to do this? I have looked all over the internet and not seen a way as of yet. Any help is appreciated! ...

accessing a class from another activity

Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs class - extends PreferenceActivity and implements OnSharedPreferenceChangeListener MainActivity creates a MyLayout class and sets it as its contentview. Once the user presses on the menu, Prefs class starts where the user can change some s...

Dynamic preferences for a variable number of profiles in an Android app

Hi, I am looking for a way to create dynamic preferences where I don't need to hard code the preference key and I could have a variable number of preferences. Basically, my application will let the user create a multiple number of profiles and each of these profiles will save custom values for a fixed number of preferences. So this w...