My Android app force close certain time when it is running on device.I want to store that error log in a text file on device.So i can see reason behind force close.Because it is difficult to identify when sudden force close occure when app is running. Can you provide me some way to create a log file on sd card.
Thanks in advance.
I have following code when app start but it after adding this code app is not force close,and log file is showing null.
 Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread thread, Throwable ex) {
            Log.e("UNCAUGHT EXCEPTION", thread.toString());
            Log.e("UNCAUGHT EXCEPTION", ""+ex.getMessage());
            try {
                PrintWriter out = new PrintWriter("mnt/sdcard/log.txt");
                out.println(ex.getMessage());
                out.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
          }
    });
 
     
     
    