2

How to replace force close screen with dialog box and appropriate error message? Can any one help me to come out of this ?

K.Muthu
  • 1,232
  • 1
  • 16
  • 38
  • This error message indicates that there is some problem with your code so better try to fix the error so that this message should not come. – Nishant Apr 30 '12 at 04:42
  • You can't do this. If you've any error in between, then change the code accordingly. And keep meaningful dialog message for that. – Krishna Suthar Apr 30 '12 at 04:42
  • thank u both. can u help me to get error log – K.Muthu Apr 30 '12 at 04:52
  • 1
    check http://stackoverflow.com/questions/2866565/how-can-i-see-the-error-log-logcat-for-android-in-eclipse for viewing error details. – Nishant Apr 30 '12 at 04:54

2 Answers2

4

The force close screen is an Android default display that indicates that an error or exception occured in your code that wasn't handled: you can't override it, and the only way to prevent it is to figure out and then actually handle the exception that occured in your code.

If you need help debugging to determine what the actual exception or error was take a look at the debugging guide.

Femi
  • 62,839
  • 8
  • 114
  • 142
  • You'll need the android sdk installed (which you probably have already given you're building code). `adb logcat` in a shell or command prompt should print out the device log and when your force close appears you should see the exception that is causing the crash. – Femi Apr 30 '12 at 05:14
1

Use Thread.setDefaultUncaughtExceptionHandler().

Krishnakant Dalal
  • 3,480
  • 7
  • 32
  • 60