Android :: ListPreference NOT Save To SharedPreference?
Mar 21, 2010
I am resuing ListPreference for a setting which I store in the database. I do not want it stored in the preference file. How can I reuse ListPreference in such way that it does NOT save to SharedPreference file?
View 2 Replies
May 1, 2010
I have Listpreferences in my app. They don't appear to be setting to their defaults right after installation - they appear to be null. I'm trying to figure out why my default preferences are not being set right after installation.
In my main code I have:
CODE:......
Right after the above code executes, each variable contains "defValue" instead of the actual values I have assigned in my ListPreference below.
My preference xml file is called, "settings.xml". Here's what one of the ListPreferences there looks like:
CODE:.............
Here's what some of my strings.xml file looks like:
CODE:.................
When I go to menu, and then settings, I can see my defaults checked (radiobuttoned). Then when I go back from the settings menu to my main screen - all is well - for life! ...then each var above is assigned the proper default value.
This only happens when I first install my app on the phone. After I go to the settings screen once and then right out of it, the app is fine and accepts any setting changes.
By the way, as you can see, "List1" is the android:key within a file called settings.xml in my res/xml folder.
View 1 Replies
View Related
Oct 2, 2009
When using a PreferenceActivity to do preferences, the PreferenceScreen can contain a ListPreference. A ListPreference has an array of keys and an array of values. But the PreferenceActivity only writes the values to SharedPreferences. How do I get the key of the item selected from the list? I would have thought this is pretty fundamental, especially if you want to translate your app.
View 13 Replies
View Related
Mar 25, 2010
I'm using listpreference in my android app and getting my key values and all is well and works good (now that you guys have helped me) BUT - when my listpreference menus popup, they only contain a cancel button. Let's say the user is choosing between red, blue, and green. When the listpreference dialog first pops-up, the dialog only shows a cancel button. Because of that, the dialog disappears as soon as the user selects their choice. I would like it so that when the user chooses their setting, they see the radio button get highlighted and then they go ahead and click the ok button...but I don't have an ok button and can't figure out why.
View 1 Replies
View Related
Aug 7, 2010
Is there a way to use a custom row for the ListPreference in the Android preference screen? Currently I populate the ListPreference like this, but I need more info (description) shown in the List
int count = items.size();
CharSequence[] entries = new CharSequence[count];
CharSequence[] entryValues = new CharSequence[count];
for (int i = 0; i < count; i++) {
entries[i] = items.get(i).toString();
entryValues[i] = String.valueOf(i);
}
langPref.setEntries(entries);
langPref.setEntryValues(entryValues);
View 1 Replies
View Related
May 28, 2010
I want to put a ListPreference in my preference screen. But all the examples I have found in Internet the content are loaded out of a xml and I need that de options in the ListPreference are dynamic and not previously defined (in a xml).
I have mi preferences.xml in the folder xml/ of my project;
this is the code of preferences.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android
View 4 Replies
View Related
Mar 6, 2010
I have an XML preferences screen which is handled by addPreferencesFromResource. On it, there is a ListPreference, for which I want the summary to contain the current value of that preference. I think this would be a common requirement, as otherwise you could not see the present value of the preference without expending a click. I read that the summary field supports resource references, and I see that I can refer to preferences as android:summary="@+preference/prefname" in my ListPreference. Clearly this is why resource references would be supported in this field. However, when I try this, instead of the present value of prefname, the text "false" appears as the summary. Does anybody know how to display a current value without taking the seemingly ridiculous step of rewriting the entire (large) preference screen in Java?
View 5 Replies
View Related
Sep 22, 2010
I'm trying to set a defaultValue to a ListPreference item. Here is an sample of my preference.xml file:
<ListPreference android:key="notification_delai"
android:title="@string/settings_push_delai"
android:entries="@array/settings_push_delai_human_value"
android:entryValues="@array/settings_push_delai_phone_value"
android:defaultValue="????">
</ListPreference>
The two arrays:
<string-array name="settings_push_delai_human_value">
<item>every 5 minutes</item>
<item>every 10 minutes</item>
<item>every 15 minutes</item>
</string-array>.............
View 1 Replies
View Related
Jan 17, 2010
This is my first Android app (which is a soft keyboard, with dvorak layout) and so far it has gone pretty smoothly (either because or despite working from the sample code). I've had some problems (with special/swedish characters) that I've managed to take care of, but this problem I can't figure out how to solve..
But when I click the list item to edit it, i get an empty dialog (Title and button is shown right and with the text I set in the xml- file, but no list, screenshot: http://i49.tinypic.com/2501p55.png ). I can't see any problem with the program code (which isn't many lines..) or the xml (the arrays are generated by the Android utils in Eclipse and the preferences is a mix of auto and manual). You can see both Java code and XML here: http://pastebin.com/m4c52c3a2 (titles etc in Swedish..) (I've also tried a EditTextPreference item, which seemed to work fine..) I have also looked at the log/output using adb, and can't see any problems there either, so I have no idea onto how to solve this.
View 2 Replies
View Related
Mar 23, 2010
I have a settings menu that pops up and in it is a listpreference type menu. It is associated with a settings.xml file where there are 'array-strings' within it. It all works good but I don't know how to retrieve the users preference. As an example, let's say the user picks a color (red, green, or blue). The list that I've made within my 'array-strings' contain the text red, green, and blue. Within my code, I would like to do something if the user has choosen red, something else if they choose blue, etc., etc. Would I use a 'case' statement or an 'if' statement? And most importantly, how would I retrieve the users preference - the key? (am I checking for a boolean?)
View 2 Replies
View Related
Aug 27, 2010
I'm betting im missing one small thing. I've looked on the developer site and i've read some tutorials and i'm just not seeing what i did wrong. I'm trying to use a ListPreference to decide which sound to play on a button click. I have this at the top:
public String greensound;
Here's my OnClick code:
case R.id.green:
SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
greensound = prefs.getString("greensound", "gsone");
if (greensound == "gsone") {
mSoundManager.playSound(1);
} else if (greensound == "gstwo") {...................
View 3 Replies
View Related
Oct 12, 2010
I have a ListPreference with the entries and entryValues correctly set. When I go in the prefernces activity and change the value it successfully works (I added a Toast to output the value after changing the option to test). But when I do the following to compare it, it always executes the else statment when I change it everytime, even like above when I changed the ListPreference and the value was "bluesky" it still failed to execute the correct if statement. Here's the code I use to check the value of the ListPreference in the onResume():
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this)
String backgroundPref = prefs.getString("backgroundPref", "");
if(backgroundPref == "bluesky"){
mainLayout.setBackgroundResource(R.drawable.bluesky);
Toast.makeText(getBaseContext(), "Blue Sky", Toast.LENGTH_SHORT).show();
}else if(backgroundPref == "sky"){
mainLayout.setBackgroundResource(R.drawable.sky);
Toast.makeText(getBaseContext(), "Sky", Toast.LENGTH_SHORT).show();
}else{
mainLayout.setBackgroundResource(R.drawable.sunsetscene);
Toast.makeText(getBaseContext(), "Sunset Scene", Toast.LENGTH_SHORT).show();
}
The Toasts are there so I can double check which statement gets executed, and it always seems to be the else one. Am I having a bad day and getting something wrong?
View 1 Replies
View Related
Aug 28, 2010
I'm trying to use a ListPreference to decide which sound to play on a button click.
I have this at the top:
public String greensound;
Here's my OnClick code:................
I also tried removing the default value here it didnt seem to change anything but, should it be removed?
Here's my Settings.java:
package com.my.app;
CODE:...........
And here's my array's if that will help at all:
CODE:............
Here's a logcat that kinda looked possibly related:
CODE:..........
For those that might ask here's my DDMS > File Explorer > Data > Data > packageName > SharedPreferences This is what was in there:
com.my.app_preferences.xml:
CODE:...................
This all really confuses me more because...It looks like greensound does == gsone so.... I don't understand whats wrong its not even playing the default sound. and yes i've tested all this code without the listpreference code and they work great. I'm not sure what's wrong?
View 1 Replies
View Related
May 30, 2009
ListPreference default is Single-Choice, how to create Multi-Choice?
View 3 Replies
View Related
Jan 6, 2010
I want to have an element in my preference menu that does the following: Show a list of options. Many are selectable Maximum amount of options to be chosen 2. Possibilities I thought of: Doing a separated PreferenceScreen and showing options as checkBoxes but I don't know where to place the logic of max 2 options. Extending DialogPreference and doing it by hand.
View 2 Replies
View Related
Mar 2, 2010
I am trying to put together a modal box with a scrollable list of checkable items and an OK and Cancel button at the bottom for the user to select filters from. It seems the simplest way to do things like this in Android is to reuse API components (widgets, layouts, etc) and the closest one I can find to this looks to be the ListPreference, which basically does exactly what I want (I can even work with storing the data in SharedPreferences). The problem is that I'm not launching this modal box from a PreferenceActivity, but rather will be launching it from either of two activities: a ListActivity and a MapActivity.
View 1 Replies
View Related
May 14, 2010
I have created an account type using the AccountAuthenticator stuff as done in the SampleSyncAdapter tutorial. I am now trying to get account preferences working. I have added the line android:accountPreferences="@xml/account_preferences" to my account-authenticator and account_preferences.xml looks like so:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/alum_settings_title"/>
<CheckBoxPreference
android:key="sync_alum"
android:title="@string/sync_alum"
android:summaryOn="@string/sync_alum_check"
android:summaryOff="@string/sync_alum_nocheck"/>..................
View 5 Replies
View Related
May 29, 2010
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 figure out how to attach an adapter (findviewByID won't cast from View To ListPreference, so I can't even get a handle to the object). I would like to attach an adapter and then populate the adapter with values, which in turn would populate the ListPreference with values.
View 1 Replies
View Related
Aug 10, 2010
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.
View 1 Replies
View Related
Nov 24, 2010
How can i add, 4-radiobuttons and 2-checkBoxes in the same ListPreference in Android PreferenceScreen in android?
View 1 Replies
View Related
Apr 24, 2010
Is it possible to define a ListPreference in Xml and retrieve the value from SharedPreferences using getInt? Here is my Xml code...
And I want to get the value with something like: int val = sharedPrefs.getInt(key, defaultValue).
At the moment I have to use getString and parse the result.
View 1 Replies
View Related
Aug 29, 2010
on implementing a multi-select (check boxes) ListPreference on Android? Would I have to extend the ListPreference? Is there any classes already documented to do this?
View 1 Replies
View Related
Apr 19, 2014
I have a Motorola Moto G 8GB which is running very low on storage (only about 800mb left). This phone does not take Micro SD cards but it comes with 50GB Google Drive storage. However i haven't used this at all. I am wondering whether i could download android apps and games to google drive, dropbox etc. Games like Real Racing take up about 1GB so i cannot download it to my phone. Can i download it to the Cloud? If this is not possible, is there any way that i could save the app data on the cloud. E.g. The Simpsons: Tapped Out is about 37mb to download off the play store, but then you must download the updates etc which are about another 250mb. is there anyway to save this 250mb on the cloud. Or any other games data.
View 3 Replies
View Related
May 8, 2010
Im looking for an app that can take backup of ALL my sms/textmessages to my pc, and i should be able to read all my sms/textmessages on my pc to when i have backed them up to the pc.Is there a APP that can do that? prefer a free 1 ofc but if there is only programs i have to buy then be it.
View 2 Replies
View Related
Apr 25, 2010
Any way to save a text thread, like as a copy to my email, to print, or have a permanent copy?
View 4 Replies
View Related
Jun 19, 2010
I dial a phone number with my Motorola backflip. Then I call it. How do I save this as a contact? I have a bunch of calls in my recently dialed list. How do I save them as contacts? Why isn't this basic functionality intuitive?
View 5 Replies
View Related
Mar 12, 2010
Do you know how to save files?
View 4 Replies
View Related
Sep 1, 2010
can someone helpme out with how to save state of the app when the screen orientation is changed i read the development guide at http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange
But i dont know how to define the method collectMyLoadedData();
View 2 Replies
View Related
Jul 23, 2010
i try standart actions and get: "can't save.." using HERO on android 2.1 update)(the same was on android 1.5).
View 1 Replies
View Related
Jun 5, 2010
how do i save certain threads?
View 1 Replies
View Related