Android :: Restore Instance State

Aug 24, 2010

I need to save some state when the user leaves my game during game play. Saving the state doesn't seem to be an issue, but I can't figure out how to restore it. The onCreate function isn't called when the Activity is resumed (only when it is first created), so I can't get my state back there. Logically, I would use onRestoreInstanceState, but it isn't being called.

CODE:..........

I see log output from onSaveInstanceState, onResume, onCreate, etc, but I never see a log message from onRestoreInstanceState and savedState is always null. Why isn't onRestoreInstanceState being called, and is there another way to get my state back?

Android :: restore instance state


Android :: Recreate Pop Up Window On Restore Instance State

Jun 24, 2009

My application has floating pop up window (Pop up Window) that is successfully displayed on user click. When screen orientation is changed, everything is recreated and I want my Pop up to remain visible. on Restore Instance State is called and my Pop up function crashes whilst calling "show At Location".

View 4 Replies View Related

Android :: Robust + Easy Way To Save / Restore Droid App Instance State?

Feb 19, 2010

In Android, you need to implement the following Activity methods so your application can be restored to its previous state if the OS decides to destroy then recreate your activity:

public void onSaveInstanceState(Bundle savedInstanceState)
public void onRestoreInstanceState(Bundle savedInstanceState)

The examples I've seen of implementing these methods is to use put/getBoolean, put/getInt etc. on the Bundle object (i.e. primitive objects only) to save the application state. This seems hugely error prone way to save your state for a start and I cannot see how this scales to storing complex objects without writing lots of code.

What options do I have for storing/restoring state in a robust and easy to implement fashion?

In case it's important, my application (a game) needs to store about 50 objects, which each store maybe 5 float variables and some store references to other objects. I don't particularly want to have to write save/restore methods for every class and subclass (maybe about 15 of these) I use. It would be ideal if I could just stick all my state relevant objects in an object called "state" and then just call save/load on "state" to handle everything.

Is using Java serialization an option? I've heard it's very slow, but is that a problem for save/restoring? Could I just write my data to the SD card? To a database?

View 1 Replies View Related

Android :: Save Instance State For Dialogs?

Sep 24, 2009

I wonder what is the right way to implement this? Could anybody advice whether my solution is correct?

So:
Activity is created
User clicks on button and dialog is launched (Dialog, not dialog styled activity)
User opens keyboard
we have onSaveInstanceState called where we save that our dialog was opened and all respective dialog input
we have onRestoreInstanceState and here we check whether dialog was shown, recreate the dialog with respective input.

Is it the right approach? or there is smth. that is done by Android and I am doing some redundant actions.

View 2 Replies View Related

Android :: Save Instance State Of My Application?

Jan 11, 2010

As a follow on from my question on sharing state between Activities, how can I save the instance state of my Application? Since Application does not extend Activity, there is no onSaveInstanceState method to override.

NB: In advance, this is not a duplicate. Despite its name, How do I save an Android application's state? relates to Activity state

View 1 Replies View Related

Android :: Saving Cursor State With Activity Instance?

Apr 27, 2010

I've got an android app that pulls a random 20 questions (rows) as a cursor from a SQLite DB and loops through all the questions to ask the user all 20 questions.

Is there some way to save the cursor's state/location when the activity is paused or stopped so that when the activity resumes the cursor is restored and in the same position as it was when the activity was paused/stopped?

View 1 Replies View Related

Android :: How To Save An Instance Of A Custom Class In On SaveInstance State?

Jul 3, 2010

I created an instance of a custom class RestaurantList to hold my data (a list of restaurant data received from a web service as json data).How can I save it in onSaveInstanceState? Code...

View 1 Replies View Related

Android :: OAuth Instance State In Android

Dec 27, 2009

I'm trying to use OAuth in an Android app. I have it working correctly but have sometimes run into a problem during the authentication phase. In Android, I launch the browser for the user to login and authenticate. Then the callback url will redirect back to my application.

Here is the problem. My application has a OAuth consumer and provider as members of my main class. When the browser is launched for authentication, sometimes my main Activity is discarded to save memory. When the callback url relaunches my main Activity, the provider and consumer are new instances and therefor don't work when I try to make a request to the api. If the main Activiy was not freed during the authentication phase, then everything works correctly because I'm still working with the original consumer and provider.

I tried using onSaveInstanceState() and onRestoreInstanceState(), but haven't been successful. It seems the onRestoreInstanceState() is not called when my callback url is handled. Seems to go straight to the onResume().

What is the correct method for persisting the consumer and provider in this case?

View 5 Replies View Related

Samsung Behold 2 :: Killed My Phone - Restore This Phone Back To Its Original State?

Apr 20, 2010

I was trying to root my samsng behold 2 earlier today using the command codes on theunlockr.com. I thought everything was going well as I went all the way to the last step where it rebooted my behold 2. Problem is, the phone kinda just turned off after doing the reboot command and didn't turn back on by itself (I gave it like 10 minutes). I eventually then just turned on the phone manually and noticed that everything was super laggy. Even when I used taskkiller to kill every task minus GDE, it said I only had 38MB ram available. I rebooted my phone a few times and it was laggy everytime so I decided to do a hard reset. The problem is that when I attempted the hard-reset, it will now get stuck on the samsung screen when trying to load up (stayed there for over 30 minutes). I can still enter the phone if I just start it up regularly without trying to hard-reset, but it will continue to be VERY laggy.

Is there anything I can do to restore this phone back to its original state? I was reading about using ODIN to flash it or something, but for some reason my computer doesn't detect my phone when I go into Download mode on startup (it does however detect the usb drivers on my phone once the phone officially startsup into its homepage).

View 7 Replies View Related

Android :: Changing Displayed State Of Views Based On Parent ViewGroup's State

Aug 11, 2010

I have a compound UI component built up from a ViewGroup containing a number of TextView, ImageView etc. components. Many of these have StateListDrawables as their images/backgrounds. Is there any way of making them select from this drawable based on the state of the parent ViewGroup rather than the component itself? Ideally I want to be able to change the visual state of all children of the ViewGroup (text colour, image etc) based on the state of the ViewGroup, preferably without having to hook up complex logical code. This seems like a fairly common sort of requirement, so I was hoping it would be straightforward in Android - am I going to be disappointed?

View 1 Replies View Related

Android :: Phone State Listener State Transitions

Feb 8, 2009

I'm a little confused by what I'm seeing with regards to phone state transitions via the PhoneStateListener. When I receive a call, this is what happens: (call comes in) RINGING -> IDLE (I pick up) OFFHOOK (I hang up) IDLE It's that first transition from RINGING to IDLE without any interaction from me (not ending the call, not answering the call) that confuses me. Do I really have to implement an idle counter to know that an incoming call has really ended? Seems like the reported phone state represents some sort of phone state that isn't the obvious one.Is this a bug or am I just not in tune with the paradigm here?

View 2 Replies View Related

Sony Ericsson Xperia X10 :: Back Up Restore Failed On Restore Function

Nov 18, 2010

Anyone else had abny issues with the back up restore function? I tried to do a software update, to which something seems to have happened. All i can see for the time being is an update to the virtual keyboard. Anyway, lost apps, contacts etc, so went into the menu on the handset and selected back up, restore. Restored numbers etc to phone book and over 150 number details are missing. The back up utility doesn't seem to have backed up all my numbers. Also, any personal photo's of callers etc have either vanished or the photo's are now against the wrong people. So much for this back up service, it's going to take hours, if not days to try to get the phone back tot he way it was!

View 5 Replies View Related

HTC Eris :: How To Restore Market Links After NAND Restore?

Aug 9, 2010

Today the rom bug bit me and I tried about 3 or 4 different roms (after TIbackup and nand backup of course) including xtrROM and ELB, hated them all, and decided to go back to my beloved sense-able 3.1 nand backup.
wiped, restored, and now all my market links are gone. (except for gmaps, for some reason). TIbackup refuses to even install again from the market because the package signature is incorrect, or something. TIb said it was supposed to restore market links.any suggestions? is there even any way to restore a market link besides just reinstalling the program outright? I found this thread http://androidforums.com/all-things-root-hero/81290-market-does-not-see-all-my-downloads-after-nandroid-restore.html as reference. All my programs will show as "installed" if I search them in market.either way, sense-able was definitely the sexiest-out of the box ROM I tried. everything else without sense was just ugh, looked like I'd loaded up a G1. couldn't tell a speed difference at all with the same setCPU profile, and xtrROM was so bad on battery I only made it through few hours before uninstalling. I cannot live with the sense keyboard and search-dialer.

View 1 Replies View Related

Motorola Droid :: Backup / Restore / Get My Files Restore?

Mar 7, 2010

I Installed Smoked Glass V5.0 from V4.5. I ended up doing it twice, and to make a long story short I lost my files in AK Notebook.
Here's my question:
1. Should I backup my current configuration
2. Then "Restore" my backup prior to upgrade
3. Grab my files (hoping they will be there) toss them on my mac
4. Then just "Restore" back to where I am now?
Need those files by tomorrow, any assistance is much appreciated. It's not that it's an emergency without them, but I will have to do some legwork to gather that info again.

View 8 Replies View Related

2.1 Update :: I Can't Restore My Data Via Backup & Restore

Nov 8, 2010

I recently updated my Mini Pro to Android 2.1, I followed the steps on the sonyericssonsupport YouTube video. I did a Backup of all my stuff on the phone, when I'd updated my phone and turned it on it asked me to setup the phone again with the Language, Time & Date etc and now when I try to restore my settings it says "Could Not Restore" when it is almost done.

View 1 Replies View Related

General :: Nabi 2 - No Images To Restore Under Restore Tab?

Mar 26, 2014

I have a Nabi 2 that was rooted almost a year ago to gain access to the Google Play store.My needs have changed since then and I wanted to restore it to factory settings.

If I boot normally the Nabi is stuck here:

I have managed to get it to boot to TRWP by pressing the power and + keys. I see this:

There are no images to "restore" under the restore tab. This is what I see:

provide me with a kernel file or some tips on how to restore the machine to it's 'out-of-the-box' configuration. I want to donate this device to a young child and need to get it back into a kid friendly mode.

View 9 Replies View Related

Android :: 2 Instance Of Same Activityes

Apr 2, 2009

My application has 2 activities. The main activity will create the "child" activity through startActivityForResult((...). When the child activity needs to exit, it calls setResult(..) and finish(). Child activity will start and exit multiple time upon user selection. The activity are start and exit as expected and onAcitivtyResult(..) also got invoked.

However, I found a problem with child activity, when the child activity was created the second time ( Main activity called startActivityForResult(...) upon some user event ), a new instance of child activity was created, but the displayed is the FIRST instance child activity! ( so any state in second instance of child activity was not accessible ). The onKey(...) was always go to first instance of child activity. Make things more interesting, the getInstanceCount () returns 3.

I have checked the code and no where holds the first instance of child activity which should be garbage collected after finish().

View 3 Replies View Related

Android :: More Than One Instance Of Application

Apr 9, 2009

Is there a way to prevent the user of opening more than one instance of my application?

For example: User clicks on App and opens it. The user clicks on the home button. (the app is still running in the background) The user clicks on (not the menu button, but the button above it in the homescreen), and then opens the application again. Does it open the same instance, or does it create another one? If it does create another one, how can I prevent it from creating another one, and just opening the existing instance?

View 6 Replies View Related

Android :: Get Instance Of The Activity?

Jul 9, 2010

Is there a way to get an instance of the activity that has called the currently running activity from the intent object that has been passed to it? eg. if A has called B, I would like to retrieve A's instance from the intent in B's onCreate method. As Activity is not Serializable i am not able to pass the instance in the extras bundle.

View 1 Replies View Related

Android :: Launching New Instance?

Sep 7, 2010

I have two activities.A and B. A starts B.Both are running in the screen and both are visible. Say now B is visible.

On a special key press, I want to bring the A to the front and make it active. The problem I am facing is when the special key is pressed, another instance of A is launched and the new instance is brought to the front.

But I want the original A to come to the front. I want to make this change in the framework layer rather than application specific by using the singleInstance theme in the launchMode in AndroidManifest file.

View 5 Replies View Related

Android :: Instance Of Widget Currently On Homescreen?

Jun 24, 2010

Is there a way to know if there is an instance of your widget currently on the homescreen? I always end up using variables that change state with onUpdate() and onDeleted() calls, but that obviously that isn't effective in every scenario.

View 9 Replies View Related

Android :: Display Calendar Instance

Nov 22, 2010

I have referred the example given on: http://goo.gl/1uxXv , But it is not showing the exact DatePicker dialog as given in the book example, what i should do to display the same dialog box or Calendar instance in my application ?

View 4 Replies View Related

Android :: Identify Among Various Service Instance

Nov 6, 2009

Im creating a mail application, where i need to start a service instance for every account, which will check for the new mails for that account. Now my problem is that i want to identify how my service i have created so far (by calling startService()). And also i want to stop a specific instance of service. I know that calling stopService() will stop all the instances of that service. Is there any work around to it.

View 2 Replies View Related

Android :: Get File Path From URI Instance

Nov 17, 2009

I am trying to do the following.

I have an Image viewer where in the user picks an Image from within the gallery. The uri to that selected Image is available to me. Now, I want to use this URI information and send it as a file over a socket using FileInputStream. Is this a valid syntax to perform the above action?

CODE:..............

View 10 Replies View Related

Android :: Recover An Instance Of An Activity

May 9, 2010

I have a bunch of tab activities (which I implemented myself, didn't want to use the tabviews with activities inside them), so It's basically 5 activities calling each other every time the user clicks on the tabs displayed as a row of LinearLayouts at the bottom of the screen.

The thing is that the way I do it now, everytime the user jumps from one activity to another, a new activity is created and launched. Of course, I can see I'm wasting resources this way. So what I would like to do is to create every activity only once; and then if the user wants to go back to the previous (or any one that was already created and is probably paused) just check on some kind of list or array to see if the activity can be recovered and only in the case it can't; to lauch a new one.

My question is, how can I check this? should I save the intents? and how to recover the activities afterwards? I'm kind of new with java.

View 2 Replies View Related

Android :: Obtain An Instance Of ServiceState

Jun 26, 2010

I'm trying to obtain an instance of ServiceState in my Activity. But how am i supposed to do this? There is no static method to obtain an instance or any method on any service that returns an ServiceState instance.
There is the TelephonyManager.listen() call. But i want to get the ServiceState instance when i want, not when android calls my listener because something changed.

The documentation of ServiceState can be found here: http://developer.android.com/reference/android/telephony/ServiceState.html

View 2 Replies View Related

Android :: Get Instance Of The Launched Activity

Jul 19, 2010

Is there any way to get the instance of a launched activity(or any view in that activity )of a application in another application.

View 1 Replies View Related

Android :: How Finish An Activity In This Instance

Aug 16, 2010

We all know that hitting the back button on the device doesn't kill the application, it merely finishes (destroys) the activity running on the foreground.

Well I have come across some code which helps me capture the back button signal so that I cannot exit the application. The only way to exit it in such cases is to press the home key.

Now this situation presents me with a unique disadvantage! The inability to kill finish the application on a time of my own choosing allows the application to keep running in the background like nothing has changed.

So in such cases is the task manager my only friend or is there a way for me to otherwise kill this application?

View 2 Replies View Related

Android :: Create Only One Instance Of Service

Sep 11, 2010

How can I make sure that only one instance of Service is created?

I have checked some functions with logging (WeatherService is the class who extends Service):

CODE:........

It gives different hash codes even when I am sure that the same function is running twice (downloading):

CODE:............

I am binding a Activity to the service with:

CODE:.......................

And the service can run for minutes until it is completed, therefore the service can be binded to/created by many Activities.

View 1 Replies View Related

Android :: MediaPlayer - Only One Instance At Any Given Time?

Jun 28, 2010

I have a audio player app, where there is a Main activity that shows 3 audio sample urls. On click on one, it goes to a Details Activity, which has a play and pause button, to start and pause the audio.

My problem is that, when I start the Main activity, and say click on audio 1, I hit play on Details activity. This starts the MediaPlayer and the audio starts to play. When I go back to the Main activity, the audio is still playing, which is what I want. Now, when I click on audio 1 again, and go to Details Activity and hit play again, there seems to be a new MediaPlayer starting the audio. So I have 2 tracks playing together!

Is there a way I can have only one MediaPlayer instance at any given time?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved