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 ...
I want to save an ArrayList so that it is persistent. The contents can change. What is the best way of approaching this in android?
...
First, a bit of my background. I have been working on large web systems for over a decade, Android is something I have been looking at for the past two months; as you can imagine, the gap is quite wide :)
Looking at Android's Security and Permissions and Data Storage part of documentation, talking directly to developers, reading books a...
Hi all,
^Question^
I think that it would be too complex to open a database. Does using shared preferences make my app's data size become big. Is there a temporary storage place for my data or should I delete the data in the shared preferences for that widget.
Short code samples are very appreciated :)
Thank you
...
Does Android provide smth. like that OR do I have to check every time during start of my app "Oh, am I freshly installed? Do I have to initialize the Shared Preferences now?"
...
How do I delete SharedPreferences data for my application?
I'm creating an application that uses a lot of web services to sync data. For testing purposes I need to wipe out some SharedPreferences values when I restart the app.
...
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...
Hello everyone
Im building my custom android build.
I have an two different applications, one that writes the sharedPreferences with "MODE_WORLD_READABLE" and the other application that reads from there.
When I install trough "adb install" the application that writes the sharedPreferences everything works fine. I can see with "adb sh...
I would like to know if the user is using the application for the first time. I am using SharedPreferences, but I am not sure if I have the right logic.
How can I set my isFirstLaunched boolean to true when the user first launches, and then immediately set to false after work has been done?
protected void onStart() {
super.onS...
I've implemented onSharedPreferenceChanged in my main activity.
If I change the preferences in the main activity, my event fires.
If I change the preferences through my preferences screen (PreferenceActivity) my event does NOT fire when preferences are changed (because it's a separate activity and separate reference to sharedPreferen...
Hello, I have some information stored as SharedPreferences. I need to access that information from outsite an Activity (in from a domain model class). So I created a static method in an Activity which I only use to get the shared preferences.
This is giving me some problems, since apparently it is not possible to call the method "getSh...
I have made a custom preference (i.e. a preference with a custom layout) which displayed in the preferences list of a PreferenceActivity.
The layout is created in code. The problem is that the font of the TextView created in code looks somewhat different than Android's standard preference font.
So the solution would be to apply the s...
Just a random question. I'm learning a bit of Android right now, and in most examples, it seems a lot of common items (such as buttons, editboxes etc) get requested within each function using (cast) findViewById().
Is it considered good or bad practice to store the result of that in an Activity's member values? Simple example:
public c...
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Notifications">
<CheckBoxPreference
android:key="vibration"
android:title="Vibrate"
android:summary="Vibrate phone for notifications" />
...
Hi, I'm new to android development - using a book called Sams Teach Yourself Android Application Development in 24 hours. Followed it so far but got stuck trying to use SharedPreferences.
In the folder src/com.androidbook.triviaquiz I've got a file called QuizActivity, in it I've got the following:
package com.androidbook.triviaquiz;
...
Hello,
I created a weather widget. I store its configuration in sharedpreferences. The widget is updated by a service. I keep the weather information together with forecasts in an array. After the phone is off for the night i find that the array values are gone,maybe the system suspended? the service. Is there a way to store the array in...
If not, is there any workaround? I have an array list of objects that have a name and an icon pointer. I do not want to use a database.
...
Basically what I want to do is when the preference is switched from the default to whatever to load up a new set of parallax backgrounds. With the code now which is probably over complicated and maybe completely off When I switch my preferences nothing changes. You can definitely tell I'm a novice but, your help would greatly be apprecia...
Right now I am trying to save a variable when i close the app and get the variable back when i open the app back up. I have no idea if I'm doing this right. My variable is called count and would like to save and restore it. Is this right? If so, why isn't it working? If not, what do i need to change? (i'm obviously using SharedPreference...
Just a simple question in onSharedPreferenceChanged you can do something based on if a change is made in a specific key which would look like, if (key.equals(Theme_Preference)). I want to do the same thing but instead of just a key I want it to be for a specific entryValue in that key. Hope this makes sense.
...