Why context.startActivity(intent) not starting the activity and how to handle exception in android?
before the startActivity, add error.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
. There are also more complete answers here