App
Public Member Functions | List of all members
mhr.app.AppMainActivity.UIEH Class Reference

Exception Handler pro UI vlákno. Vypíše chybové hlášení do souboru. More...

Inheritance diagram for mhr.app.AppMainActivity.UIEH:

Public Member Functions

void uncaughtException (Thread thread, Throwable ex)
 

Detailed Description

Exception Handler pro UI vlákno. Vypíše chybové hlášení do souboru.

Definition at line 166 of file AppMainActivity.java.

Member Function Documentation

void mhr.app.AppMainActivity.UIEH.uncaughtException ( Thread  thread,
Throwable  ex 
)
inline

Definition at line 169 of file AppMainActivity.java.

{
File root = getExternalFilesDir(null);
File err = new File(root, "err.txt");
OutputStream output = null;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
BufferedWriter writer = null;
try {
output = new FileOutputStream(err);
writer = new BufferedWriter(new OutputStreamWriter(output));
writer.append(sw.toString());
writer.flush();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Unhandled exception " + e.toString());
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
throw new RuntimeException("Unhandled exception " + e.toString());
}
}
if (output != null) {
try {
output.close();
} catch (IOException e) {
throw new RuntimeException("Unhandled exception " + e.toString());
}
}
}
ex.printStackTrace();
finish();
}

The documentation for this class was generated from the following file: