Fatal error: show 'Unexpectedly crashed' instead of 'Fatal error'

This commit is contained in:
khanhduytran0 2020-08-08 16:04:51 +07:00
parent 7c68a3ac2a
commit 3bbec01507
3 changed files with 4 additions and 3 deletions

View File

@ -6,11 +6,12 @@ import android.support.v7.app.*;
public class FatalErrorActivity extends AppCompatActivity public class FatalErrorActivity extends AppCompatActivity
{ {
public static void showError(Context ctx, Throwable th) { public static void showError(Context ctx, boolean isFatalErr, Throwable th) {
Intent ferrorIntent = new Intent(ctx, FatalErrorActivity.class); Intent ferrorIntent = new Intent(ctx, FatalErrorActivity.class);
ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ferrorIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ferrorIntent.putExtra("throwable", th); ferrorIntent.putExtra("throwable", th);
ferrorIntent.putExtra("isFatal", isFatalErr);
ctx.startActivity(ferrorIntent); ctx.startActivity(ferrorIntent);
} }

View File

@ -17,7 +17,7 @@ public class PojavApplication extends Application
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
@Override @Override
public void uncaughtException(Thread thread, Throwable th) { public void uncaughtException(Thread thread, Throwable th) {
FatalErrorActivity.showError(PojavApplication.this, th); FatalErrorActivity.showError(PojavApplication.this, true, th);
android.os.Process.killProcess(android.os.Process.myPid()); android.os.Process.killProcess(android.os.Process.myPid());
} }
}); });

View File

@ -52,7 +52,7 @@
<string name="alerttitle_installoptifine">Select OptiFine jar file</string> <string name="alerttitle_installoptifine">Select OptiFine jar file</string>
<!-- Error messages --> <!-- Error messages -->
<string name="error_fatal">Fatal error</string> <string name="error_fatal">Unexpectedly crashed</string>
<string name="error_checklog">Error! Please check the log below: %s</string> <string name="error_checklog">Error! Please check the log below: %s</string>
<string name="error_no_version">No version!</string> <string name="error_no_version">No version!</string>
<string name="error_load_version">Unable to load version %s</string> <string name="error_load_version">Unable to load version %s</string>