Android :: Practices On Droid To Keep Data Between Activities Deathes / Restarts For Whole App Session?
Jan 9, 2010
We're designing an Android app that has several activities which are working in a wizard like way - user should pass from the activity #1 to activity #5 to get to the final activity (#6).
Since we know an activity can be suddenly terminated by OS on low memory we used Application class as a static storage for keeping the data the user inputs on "wizard" activities and other data our app needs for the whole session.
Unfortunately we've discovered this approach fails - looks like the Application class instance is also can be killed by OS (this was specifically discovered on Android 1.6 versus 1.5). Are our expectations wrong on this approach (we think Application class instance always lives for the whole app session)?
So the question is - what is the best practices on Android to keep data between activities deathes/restarts for the whole application session?
View 2 Replies
Nov 19, 2010
I make an app with some activities.
The first is the login.
If I login correctly, I pass to the second activity, and I want download a stream (like twitter), but I cannot keep the session.
I saved user & pass in sharedpreferences, how can i keep the session through all activities?
View 1 Replies
View Related
Oct 23, 2010
Understanding how to declare activities in the manifest file, how to set the appropriate flags when starting them through intents, is quite challenging in all but the default cases. The combination of all these settings and flags is daunting. I've been developing for Android for over a year now, have read the application fundamentals and the reference guide for 'Intent' quite a few times and still I don't have a good grasp of which manifest settings or intent-flags should be used for starting activities in many situations (workflows). Is there some source/document that can explain certain work-flows (ways of navigation through activities and tasks), that shows examples of how to configure and start activities?
View 4 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
Aug 26, 2010
I have an activity with multiple list views that are continuously receiving new values form a socket thread, another thread parses the data and updates the array adapters, then the ui thread calls notifyDataSetChanged() to cause the list to refresh.
My issue is that im refreshing all the list a couple of time a second, this causes the UI to be very laggy when some animations need to happen.
I was wondering what the best way is to update multiple lists with multiple value changes every second?
View 3 Replies
View Related
Jul 29, 2010
What is proper way to exchange data or objects between different Android Activities?
Welcome screen <-> Main Screen <-> Startup routines <-> Processing data <-> Settings
Is it normal/recommended to have more than one activity in Android app? in my opinion, it's somehow strange to have this model of data exchange inside application
View 3 Replies
View Related
Jun 3, 2010
How to pass data between activities in an Android application?
View 1 Replies
View Related
Aug 5, 2010
So im running the froyo rom and meat kernel and have been for a couple weeks. Within the past couple of days i have been suffering from thje random restart problem at least once a day. Anybody know what the cause of it is and how to stop it? Same with the data lock up? what gives? I dont recall either of those 2 things happening with the stock os but the airplane mode problem did. Also my wifi tether absolutely does not work and nobody has been able to tell me why yet lol. That was one of the main reasons i rooted and flashed. I dont really wanna go back to stock because my battery life is better. What gives here with these 3 problems?
View 12 Replies
View Related
Jun 30, 2009
Is it possible to transfer data between activities without using "extars"? I need to access MyOwnObject in Atctivity 1 from Activity2 Possible with using static fields?
View 6 Replies
View Related
Jul 2, 2009
The main activity includes some variables with set values. I created a sub-activity with the form which has to be filled with the data from main activity so I guess the data have to be passed to the sub-activity when it starts. how to pass the variable values to the sub-activity from the main activity?
View 1 Replies
View Related
Oct 6, 2010
I'm developing an app which basically navigates through a xml-feed. When I parse the feed or let's say the list, then each (list)item becomes a model. All the models are wrapped up in an array list. Now, when the user clicks on a list item, the underlying model is going to be serialized and sent as IntentExtra to the next Activity (e.g. a deeper sub list). (Originally I asked here a different question. The solution was not related to Serializable and wouldn't help anybody. However MatteKarla gave an interesting input. Thats why I decided to rewrite this question.)
View 1 Replies
View Related
Apr 7, 2010
I was playing a bit with adapters cursors and activities. Let's assume i have a cursor containing a query I've made (it doesn't matter if it's to DB or content provider). Now lets assume i bind some of the data (first two rows) to a list activity. Every click on one of those items should open a new list activity (i pass on the cursor index in the activity bundle). Now the question is, which sharing method will be most efficient and right from code point of view ?
1. I thought of trying to send the cursor object in the intent itself (hoping it implemented runnable) but I'm not so sure it's that efficient since the query may contain many rows which will need to be parceled, and i the other intents uses only a few (say 4-5 columns of each row) it's a real waste.
2. Thought of trying to create the array list for my other list screen adapter and serialize it to the intent (again use serialize and intent to pass on the data) but again i fear for efficiency penalty.
3. my last solution was to use static cursor member in my first activity, with package permission, it will work and be relatively efficient, but I'm not so sure regarding memory efficiency and code structure, i'm not fond of using static variables in any case.
Is there another sharing method that i don't know off, if two activities share the same process and application, then they also share memory space, then it should be easy to pass variables from one to another, the question is what's the easiest way without serializing ?
View 6 Replies
View Related
Aug 10, 2010
I did some digging, but couldn't find a clear answer. I have an application with TabActivity as the main activity. I have some computing and network communication that needs to be done when user clicks on the big red jolly "DO IT" button. One tab hosts the form with "DO IT" button, while the other tabs display the results from computing (each tab displays different part of results). The computing is done as AsyncTask as it's supposed to be (afaik).
Now the question is, what is the best way to share the results between the tabbed activities? It can be done with ContentProvider + database from what I have read, although that seems like a bit too much for my needs. I have also considered an option to save the results to some cache file activities could read in onCreate, onResume etc and display the data. Are there any other convenient ways to share the data? (To make it more clear, the data aren't simple, so doing it through preferences etc is impossible.)
View 5 Replies
View Related
Mar 13, 2009
I was looking out for ways to share data between various activities that one may need to create for his applications . Using "Parcel" and Bundle one can do data exchange , but looks like this is a bit cumbersome process specifically if you have to share large array objects with too many fields.
As android.app.Application maintains global state for the application , we can use this class to store global data and access it across activities. Is this a good way ? Are there any implications on allocating large objects in the your class which extends from android.app.Application ?
View 6 Replies
View Related
Mar 9, 2010
I have a TabActivity, and the tabs point to sub activities. Is there a way I can send a 'message' to those child activities? I just want to pass a string across, not sure if this is possible.
I have some data being fetched by the parent TabActivity, and the child tabs can't do anything useful until the parent is done fetching. When fetching is complete, I'd like to pass that data to the child activities so they can do something useful with it.
Normally I'd set the data to be passed in the Intent when first creating the activity, but in this case I can't do that.
View 2 Replies
View Related
Sep 25, 2010
Can anyone please recommend a training session/course for Android graphics API/OpenGL ES?
View 1 Replies
View Related
Aug 23, 2010
I am working on a small android project where it is necessary to share some data amongst several activities and a service that runs in a separate process. I would just like to know what are my options in terms of sharing data? Application class? IPC? File-based? Broadcasts?
View 3 Replies
View Related
Oct 13, 2010
What are the best practices to design webservices for mobile (particularly Android) apps?
Personally I'm focused on using JSON (and not XML) and I try to make it the less verbose I can. But I'm probably missing a lot of things.
View 4 Replies
View Related
Apr 23, 2010
The Facebook application that came loaded on my Droid has been working fine for 2 months. This afternoon, at first I couldn't access anything that had posted since this morning. Now I can't get anything at all. I keep getting an error message: "102/Session Key invalid or no longer valid" And it even happens when I try to go to my profile!
View 7 Replies
View Related
Nov 16, 2009
I am trying to pass a custom object to one activity from another. What I would like to use is the HashMap of WeakReferences, but the description isn't clear, at least to me. From above URL: "A HashMap of WeakReferences to Objects. You can also use a HashMap of WeakReferences to Objects with Long keys. When an activity wants to pass an object to another activity, it simply puts the object in the map and sends the key (which is a unique Long based on a counter or time stamp) to the recipient activity via intent extras. The recipient activity retrieves the object using this key."
MyObject object = new MyObject(); HashMap map = new HashMap(); WeakReference reference = new WeakReference(object); map.put(reference.hashCode(), reference);
Intent i = new Intent(myIntent); i.putExtra(map);
I know this is probably way off but I can't figure out how this is intended to be implemented based on the description. Are the keys hashcodes, user defined, or what? It sounds like all that is passed is a HashMap containing the key values but how is the object retrieved with just the key? I couldn't find any code examples or useful documentation on this method of passing objects
View 3 Replies
View Related
Jul 22, 2009
I have been using SharedPreferences to share data between activities. But I would very much like to find a better way. I would simply like both Activity1 and Activity2 to share Object1. Activity1 will create Object1 and then start Activity2. What is the smartest way to give Activity2 a pointer to Object1?
To summarize: Activities don't have constructors! How do I send data to them from their parent activity?
View 17 Replies
View Related
Jun 26, 2010
I am working on an android application, where there are 4 activities. Activity1 is main activity and there are different buttons on that activity which can open other activities. Other 3 activities can also open each other. There is a thread running in Activity1 which returns some counter. I need to show that counter on all activities. At an specific time, the thread doesn't know which activity is at top. What is the right way to control this scenario, such that thread output should update on all activities, no matter which one is at top?
View 1 Replies
View Related
Jun 16, 2010
I've had my Incredible since 4/28, and everything has been working smoothly up until about last Thursday night when it just restarted out of the blue while I was listening to music. Then right after it booted up, it restarted again, then again about seven more times. I got fed up and took out the SD card and it seemed to stop after that, so I haven't put the SD card back in since then.
Just now, Wednesday, about a week later, I was browsing around on the internet and all of a sudden, it restarted, and then again, and again, and again. I've read that it is because of poor signal strength or something like that so I had just enough time to put it in airplane mode before it restarted again.
Side note, that theory about it being caused by poor signal seems to make sense because the first time it happened to me I was out of town in a city that gets very bad coverage with Verizon, and now today when it started happening again was at my house where for some reason I get very bad service with the incredible, my old phone worked perfectly fine in my house but the incredible gets terrible service, and so does my brother's Droid. In fact, about two weeks ago I got my first dropped call on Verizon in about three years, and it was in my house.
So anyways, I decided to put it in airplane mode, and just after I put it in airplane mode it restarted again. Then when it booted back up my Helix Launcher 2 home screen went back to the standard Helix Launcher 2 icons, I go into my messages and everything is gone, my contacts are all gone, everything is gone. I go to the app menu and all my apps are still there, but when I start up an app, all the custom settings are default now. I went into the settings and my accounts are all still there. I click on internet and I get a terms of service agreement, it's as if I am booting it up for the first time, but for some reason my apps and accounts are all still there.
I turn airplane mode off thinking it might have something to do with it not being connected to my google account, and I restart it again and everything is still gone. I don't know what to do, has this happened to anyone before? I feel like there should be a way for me to get this stuff back since my apps are still there and my accounts are still synced, but random things are missing like my contacts and messages etc. This is really starting to get annoying, I have insurance and everything, but I really don't want to exchange it for another one because I've read that other people who have had there phones replaced have still had the same rebooting problem, even after going through multiple replacements.
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
Jun 24, 2010
How come when m in a call session my 3g turns off? Is there a way to enable it to stay on while in call? Because id like to multitask.
View 5 Replies
View Related
Jan 19, 2010
i have a scenario of login page after logging in there will be sign out button on each activity. on clicking signout i will be passing session id of signed in user to signout. can any one guide me how to keep session id available on all activities??
View 3 Replies
View Related
Jun 2, 2010
I am trying to learn how to do stuff in Android, and I'm not sure of the best way to build the interface.I've been working on porting an iPhone app, which uses navigation controllers and table views for looking at the different sections: basically, someone touches a cell in the table, which drills down to another table. when they touch a cell on that table it drills down to a webview that displays the information.I want to do something similar for the android app, but I don't know how, or if there is a better way native to Android. I've figured out how to use the webview to my purposes, but moving forward and backward in the table tree is unclear.
View 3 Replies
View Related
Nov 3, 2009
What is the best way to use the MediaPlayer when needed multiple times?
Reuse the instantiated MediaPlayer throughout the session? Or constantly stop() release() and instantiate a new MediaPlayer() ?
If I reuse I'm afraid the player could be in a bad state? What about performance wise? what's better? reuse or renew?
This is for using as a music player so one audio be present at one given time...
View 4 Replies
View Related
Aug 25, 2010
This is a follow up question of http://stackoverflow.com/questions/3550593/sending-html-commands-over-httpclient-android , I have successfully Posted to the server and received 200 code but when I attempt to move to another page it does not recognize that I have logged in. I am wondering if it is a session issue or if i need to follow the redirect after the POST. How would I go about following a redirect?
View 1 Replies
View Related
Oct 29, 2010
After months without a random reboot, my phone did it twice consecutively today while I was trying to navigate while streaming music (Pandora) on the way from the airport this morning. It worked perfectly on the 1 hour drive there (also on the round trip going there the previous week), but while I was waiting for the guys I was picking up at the arrival gate, I was browsing the web and still streaming music and my phone just did a "soft" restart (where it doesn't show the Moto logo, just the boot animation). Slightly annoying. At least it gets to the launcher pretty quick still. Then, maybe 30 minutes later on the trip back, it does it again while I'm driving back. This time when it got back to the home screen, it refused to pick up any sort of cell signal like it was in airplane mode, but all the other radios were on (BT and satellite). Toggling airplane mode had no affect on it. So I had to totally reboot my phone to get it to work again. I think it may be heat related, when it came back up the first time, SetCPU read the CPU at 51�C/124�F and that was immediately after reboot, so it may have cooled down some during that. After the second reboot I brought the clock down to 800 MHz from 1.1 GHz and it was good for the rest of the trip. But I was running the exact same load/apps on it the last trip and the ambient temp in the car was the same. So I wanted to see if there some system log/app that can tell me what process forced the phone to reboot or maybe what the CPU temp was when it crashed, to rule out software. Is there anything like this? If not, does anyone know what the max temp the CPU can handle before it forces a reboot? I'm sure there's a threshold for this, just like there is for PCs (but usually they just throttle instead of shutting down), but I don't know what it is. I would think ~60�C would be way too damn hot for a CPU in a hand held device.
View 2 Replies
View Related