我可以在 API 24 上的 UncaughtExceptionHandler 中启动一个活动;但是,它在 API 26 上不起作用。我想了解它为什么不起作用?
谢谢
编辑:
private Thread.UncaughtExceptionHandler _unCaughtExceptionHandler =
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
final Intent intent = new Intent(getContext(), SomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
};