Android :: Share Preference Across Several Activities?
Feb 14, 2009
I have two activities in two different packages: com.foo.a and com.foo.b. Is it possible to create an PreferenceActivity (with the exact same XML file) so that the preference is shared across the two activies?
View 2 Replies
May 28, 2009
I looked into some examples of sharing data to other apps using content Provider. All these examples talks about sharing sqlite dbs. I need to share data under shared Preferences of my app to other apps using content Provider. Can I use content Provider to do that ?. Please let me know some pointers or sample code to share data other than sqlite db using content provider.
View 3 Replies
View Related
Aug 27, 2010
Android: i want to create service by extending a Service class which i start when application get started and all activities can share its state and when i want stop it from other activity and when i want start it again from any activity ?
View 1 Replies
View Related
Jul 1, 2010
Is there any way to share the same object of the View across various activities? For example myApp has 4 activities, and every activity shows a Logo at the top of the screen. Now each activity will initiate 4 copies of the same Logo. So is there any way to get around this? And if 3 out of 4 share the same logo?
View 1 Replies
View Related
Dec 31, 2009
Is there any reason not to use the Application class to share variables across Activities? For instance a handle to the DB or a single HttpClient.
View 2 Replies
View Related
Jul 20, 2010
I am developing an app which requires me to write to an SQLiteDatabase in one activity and access it from another activity . I am facing a problem implementing this. Any suggestions/ideas as to how we can share the database across multiple activities?
View 2 Replies
View Related
Mar 16, 2010
I would like to share a cache file across activities, which are running in different processes but in a same application.So, is there any way to make it thread safe (probably not "thread safe", should we call it "activities safe" or "process safe" ?
View 2 Replies
View Related
Nov 24, 2010
It would be nice if StackOverflow had a section where we could post tutorials like mine so that I can answer literally hundreds of questions that have been asked here with a single blow. See... every day I read questions about how to pass complex objects between activities, how to save state so that your app can resume after orientation change, how to update listviews when the data changes, etc, etc. Here is the second part of a tutorial series I posted on my blog... I hope that you actually read it... because I haven't seen any examples like it anywhere... and it has changed how I think about developing for Android across the board. The question is... is there a downside or negative affect of developing like this?
Beyond Smart Lists - How Observable Singletons change the game. Please read through both of these tutorials carefully... I will answer any questions about it here that I can... I really want to know what you think about this and if it might solve issues for you. NOTE TO MODERATORS: there are no advertisements of any kind on my blog.. so don't just close this because you think I am spamming somehow... I am not going to duplicate my post here.
View 1 Replies
View Related
Jan 5, 2010
I am just wondering if anyone would like to share pics of how you have you 7 screens setup.
View 49 Replies
View Related
Jun 30, 2010
how to call BarCodeScanner, and return the value to a field.so now, i have a toast that says "successful scan" and then i want to pass the result to a new activity. when i comment out my intent, everything works (minus the passing of data/switching of screen, obviously) but when i run my project as is, it FC's no errors reported by eclipse in code or xml. any insights?
View 2 Replies
View Related
Feb 15, 2010
I have next situation: After installing application it has to init settings from server. And while it is not has right preferences it has to wait. I have several receivers and service - I don't want to check for initialization in every action in these components - I think there have to be better solution.
View 3 Replies
View Related
Sep 23, 2010
I have the following code in my application in res/xml/preferences.xml:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Wi-Fi settings">
<EditTextPreference
android:key="pref_voice_threshold_top"
android:title="@string/title_pref_voicetopthreshold"
android:dialogTitle="@string/dialog_title_pref_voicetopthreshold"
android:defaultValue="20" android:inputType="number"/>
</PreferenceCategory> </PreferenceScreen>
And I was wondering is it possible for me to then use this preference in code so I can update it via downloading an xml file? So I currently display the above preference in a PreferenceActivity, which works fine, however I want to be able to update the setting by downloading a new setting every week from the internet. So my question is how do I open this preference in code and set its value to the new downloaded value?
View 2 Replies
View Related
Feb 16, 2009
I have an Android application in which I have my preferences in a xml file, which works fine. I've now want to set one of the preferences using code instead of displaying the entire preference screen, how would I go about doing this?
View 1 Replies
View Related
Sep 24, 2009
I have pretty unassuming preferences screen based on Preference Activity. (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: 1. OnPreferenceChangeListener#onPreferenceChange if I change summary of the preference by doing Preference#setSummary the new value is painted over the old one creating unsightly effect 2. My preferences screen is large enough that user has to scroll. While scrolling, the whole screen get all messed up, again it looks like view is redrawn (when scrolled) without erasing the background first.
View 2 Replies
View Related
Aug 12, 2010
PreferenceManager contains very useful methods like "registerOnActivityResultListener" which enables you to call startActivityForResult in your custom preference like RingtonePreference does but it's restricted at the package level.So tell me, let's say I wanted a ImagePreference. How should I proceed? I want to be able to use a activity for result intent with the PICK action.
View 7 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
Jul 14, 2010
In my application i m trying to change default android SMS Setting through programming. But i haven't find any document to how to change Messages Setting in android. I have seen package android.provider.Settings but in this package i haven't find any setting regarding SMS.
View 2 Replies
View Related
May 18, 2010
When I create preference activity I define all preferences in xml file. Every preference has a key defined in this xml. But when I access preference I write:
SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean foo_value = appPreferences.getBoolean("foo_key_defined_in_xml", false);
Is there any way to avoid referencing "foo_key_defined_in_xml" in hard-coded way? Maybe there is a possibility to reference it in R style way (not to refer to string)?
View 4 Replies
View Related
May 4, 2010
How do you get the default value of an Android preference defined in XML?
Context: I don't want to repeat the definition of the default value in both the code and the preferences XML.
View 1 Replies
View Related
May 17, 2010
For my private static final String PREFS_NAME = "mypref"; does the PREFS_NAME have to be unique for every application? Or can I use the same one over and over.
View 1 Replies
View Related
Mar 16, 2010
I have a preferences.xml that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference android:name="Sample" android:enabled="true"
android:persistent="true" android:summary="Sample" android:defaultValue="3.0"
android:title="Sample" android:key="sample" /> </PreferenceScreen>
When I do sp.getString("sample", "3.0"), it works fine and returns a string, but it shouldn't be a string, it should be a float. Running sp.getFloat("sample", 3.0f) throws a ClassCastException because it is a string. What should I put in the XML so that the preference is stored as a float?
View 3 Replies
View Related
Jul 28, 2010
I like title bar style in android preference category. In my activity (no preferenceactivity) I want to use same style, how I can do?
View 1 Replies
View Related
Sep 10, 2009
There is know problem in all the Android phones. Go to Bluetooth Settings->Turn ON bluetooth->Click on bluetooth discovery->Then timer will start in summary->Long press on Bluetooth device discovery-> observe Bluetooth ON/OFF title start to toggle with Bluetooth Discovery toggle. I analyzed the issue. Blueooth ON/OFF is CheckBoxPreference. Bluetooth Discovery is also CheckBoxPreference which has dependency on Bluetooth ON/OFF. When we click on Bluetooth discovery then On thread will run at every second to update summary in Bluetooth Discovery preference. When we change the Bluetooth discovery to OFF then thread will be removed/ killed. When i press the Bluetooth discovery for long time when its already in ON State then still the thread will be updating the summary (remaining time from 120 to 00) till i press it. When i leave the Thread will stop. As it has dependency on Bluetooth ON/OFF, its making to the title invisible. But it should not happen. Solution: When i touch the Device Discovery i should kill the update summary thread then i guess, that problem will be solved. But in prefence i dont have any listener to know the pressed state. I hope somebody can give me solution.
View 2 Replies
View Related
Aug 6, 2010
I'm starting to dip my toes into LocationManager. I've created a service which tracks GPS location (interval is more than 60000ms) and updates my application with user location so they can find stuff nearby. As I understand it, users can go into their preferences and disable GPS for a particular application. I would essentially like to offer my users two modes.
1) GPS. 2) If GPS can not pull, device does not have a GPS chip, or GPS is turned off for my app, I would like to allow them to type in their zip code (or maybe switch to cell tower lookup).
The bold text is what I'm interested in. How can I tell if the device does not have GPS? How can I tell if the user has disabled GPS for my application?
Side question: My service gets launched from my 2nd Activity. I call stopService in the onDestroy method of this Activity. If I back up to my 1st Activity and the 2nd Activity is destroyed, I still notice the GPS icon on my phone running. Is stopping the service sufficient? Or do I need to stop the LocationManager in the onDestroy of the service?
View 2 Replies
View Related
Apr 9, 2010
I have a intent receiver in my android manifest, but would like to give the user the opportunity to choose whether he/her wants the app to automatically start at the specific state. Until now, I've used a service with a broadcast receiver, but I really want to delete this service as it seems a bit unnecessary.
Can register the intent action only if the user wants it (I guess not)? If not, should I make a class that will be called every time the intent is received and checks the user's preference or should I keep the service?
View 1 Replies
View Related
Mar 27, 2010
If I can modify the checkbox preference in order to inverse the direction from left to right to right to left.
View 2 Replies
View Related
Aug 9, 2009
It seems Preference summary text has a limit of about 2 lines, but I want more. How can I do that?
View 3 Replies
View Related
Sep 23, 2009
Is there a way to add my IME Preferences to the "Locale&Text" menu, just like the Latin and Pinyin IME's. Or is this restricted to the keyboards that ship with the platform?
View 6 Replies
View Related
Jul 22, 2010
I have a doubt, I don't know how to retrieve the key from the shared preference?
View 1 Replies
View Related
Jan 30, 2009
I've created a set of preference screens building on the tuts on androidguys. My preference XML contains nested PreferenceScreens. The below doesn't occur in the root screen, only once clicking to a child PreferenceScreen. Once in that PreferenceScreen, even before selecting an EditPreference, if I change orientation (i.e. flick the G1 keyboard out) I get an error: 01-30 09:33:54.080: ERROR/WindowManager(1261): android.view.WindowLeaked: that was originally added here.I have previously overcome this in other activities by utilising the onPause etc methods with custom dialogs I use. How can I prevent this in the PreferenceActivity? What am I missing?
View 17 Replies
View Related