-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSketchApplication.java
More file actions
37 lines (31 loc) · 1.33 KB
/
SketchApplication.java
File metadata and controls
37 lines (31 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.htmledit.editor;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Process;
import android.util.Log;
public class SketchApplication extends Application {
private static Context mApplicationContext;
public static Context getContext() {
return mApplicationContext;
}
@Override
public void onCreate() {
mApplicationContext = getApplicationContext();
Thread.setDefaultUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
Intent intent = new Intent(getApplicationContext(), DebugActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.putExtra("error", Log.getStackTraceString(throwable));
startActivity(intent);
SketchLogger.broadcastLog(Log.getStackTraceString(throwable));
Process.killProcess(Process.myPid());
System.exit(1);
}
});
SketchLogger.startLogging();
super.onCreate();
}
}