- The value of attribute is null
- The activity hasn't defined in AndroidManifest.xml
- etc
If your application is force close, it will appears a popup unfortunately your app has stopped working.
But this tutorial will handle it. By this tutorial, if your application face an error force close, it won't show a popup nfortunately your app has stopped working. , but the application will open an activity that you chosen.
Maybe the main process like the following :
If Activity B is force close, then go to the MainActivity
PREPARATION
Create 2 java classes :
- ForceCloseException.java
- ForceCloseDebugge
Now modify ForceCloseException.java, so look likes the following code :
Intent intent = new Intent(myContext, myContext.getClass());
you can change myContext.getClass() with activity that you wanna open if force close happens. myContext.getClass() is current activity.
Modify ForceCloseDebugger.java, so look likes the following code :
ForceCloseDebugger.java help you to see the causes of the error in your Android Studio's logcat.
USAGE
Put ForceCloseDebugger.handle(this); in onCreate() in your activity
For example how the usage :
That's all.
EmoticonEmoticon