Android Save view state after crash - android

MY application get crash for any reason one time but with same condition next time it working well means it not crash. For This I use Uncaught exception and through a error message and kill the process by using
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
Now the problem is that, I have a number of Edit Text for Taking input from user capturing photos etc, at every crash application terminate and all data loose,
Now it is very irritating to fill again data. How to get rid of from this issue please Help
I want to save the state of the application when application crash,
and when I restart my application it should be start from last position where application got crash.
same as, working in application and if press Home Button, and restart application it start from last position of application where i press Home Button.
I am new in android development please help me, to get rid off from such issue
Thanks in advance

Related

App is left open for a long period of time in the background, when brought to front it crashes

This problem happens when the user exits the app but doesn't quit the app. Then if the app is left in the background for too long it crashes when the user brings it to the front again. After the app crashes it relaunches the app, which is fine because no data is lost and it is very quick to get back to where the user was.
I pretty sure this problem is a result of the Garbage Collector recycling classes that were created in activities.
I not so concerned about fixing this problem as I don't really see it as much of a problem but I would like to keep the game from displaying the crash messages. It displays like 4 or 5 "app has crashed. send a report". And you have to hit yes or no to get through all of them before the app relaunches. Not only is this annoying for users but it also creates a lot of crash reports in my console that aren't a real concern.
My idea for a solution to my problem would be to catch these null pointers (the first always occurs at the same point) and then relaunch the app. But how do you completely quit and relaunch an app?

How to gracefully terminate an app on Android emulator with Eclipse (on Mac)

I am trying to end my app gracefully on an Android emulator without causing a crash or killing the app.
Having read numerous posts on how to terminate or crash an app on Android, here's what I've tried:
Switched the emulator to another app
Clicked the Hang up on call button and Make a call button on the emulator
Added finish(); System.exit(0); to my onPause event in the app
Clicked on the root of my program in the Debug perspective in Eclipse and clicked the red square on the menu icon row to terminate, did same and disconnected as well.
Each time I start up the app after any of the above, the tracking code is considering the above chosen method a crash.
So I'm trying to figure out how to gracefully end my app and restart it without incurring a 'crash'.
Any ideas?
Big thanks

Android App Launcher strange behaviour

hi guys i am finding the strange behaviour in android while launching the Application. Let me explain the senerio. I am launching my application from android's launcher page and my application starts and runs fine and after few minute i press home button and go to android home page and then go to launcher page and again select my application and it is starting it again from first but it should have resumed from the last place where i left. And when i press back button on the launch screen of second instance of my app i am able to go back to the last page where i have left. I am more confused about what was happening and it too happens sometimes only not every time. Hope you people could help me sort this problem, Hoping for better responses. Thanks in Advance.
Edit #1:
It is not happening in all the device it happens only with Samsung and Sony but works fine with LG and HTC.
To keep an activity running in the background is not in your hand. When you press the home button, your current activity goes to the background and can be killed (onDestroy() will be called) at any time depending on the need for memory of the other applications you launch.
The more apps you launch, the more chances of killing your background app is.
The behavior may be device specific - try saving your game settings in a persisted location within the 'onPause()' function, and retrieving it on 'onResume()'. Then it doesn't matter if a new activity gets launched or the old one gets called.

application crashes if it is in idle

i am working on an application.The first screen having login.After launching the application in device and playing with it is all ok and not any issue at all.
but if at the same time user opens any other application,uses it for a while and closes this second application and then again navigate to previously open application(on which i am working),and tries to tap or manipulate or login on the application ,application gets crashed. why so behaviour?
i am facing this issue very first time and no any idea of this.
any suggestion?
Thanks.
Check out the Android app lifecycle: http://developer.android.com/reference/android/app/Activity.html.
My guess is the Activity that your user is coming back in to is overriding the onResume() method and the method is throwing an exception or you're not calling super.onResume(). That's my best guess without any more details on what your code is doing or information from your logCat.

How to log each application activity in android?

Hello I want to log application activity information on my android phone, I just need 2 things, the start time of the application and the end time of the application.
I just want to know for how much time a particular application/activity was running.
Say for example a user launched music player and after some time closed it? I just want to know how long the music player opened, or if he is talking on phone how long that activity to took after finishing?
My application will run as service, logging all this information is sqlLite. Once my application started it should log all the above information for each activity triggered there after.
Please let me know how can i do this??
I know about logcat but i want to know how they log this things or how can i code something similar??
Thanks
Pranay

Categories

Resources