mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 22:26:56 -04:00
Debug: Show fatal error on launcher crash
This commit is contained in:
parent
9d4b607003
commit
5b12c7bfb4
@ -1,10 +1,19 @@
|
|||||||
package net.kdt.pojavlaunch;
|
package net.kdt.pojavlaunch;
|
||||||
|
|
||||||
import android.support.v7.app.*;
|
import android.content.*;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
|
import android.support.v7.app.*;
|
||||||
|
|
||||||
public class FatalErrorActivity extends AppCompatActivity
|
public class FatalErrorActivity extends AppCompatActivity
|
||||||
{
|
{
|
||||||
|
public static void showError(Context ctx, Throwable th) {
|
||||||
|
Intent ferrorIntent = new Intent(ctx, FatalErrorActivity.class);
|
||||||
|
ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
ferrorIntent.putExtra("throwable", th);
|
||||||
|
ctx.startActivity(ferrorIntent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -14,6 +14,14 @@ public class PojavApplication extends Application
|
|||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
|
||||||
|
@Override
|
||||||
|
public void uncaughtException(Thread thread, Throwable th) {
|
||||||
|
FatalErrorActivity.showError(PojavApplication.this, th);
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Tools.APP_NAME = getResources().getString(R.string.app_short_name);
|
Tools.APP_NAME = getResources().getString(R.string.app_short_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user