Here is my code: ("Apagar" means "Turn off", "reiniciar" means "restart")
public void uncaughtException(Thread thread, Throwable ex)
{
try
{
AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(iAct).create();
//alertDialog.setTitle("");
alertDialog.setMessage("Se ah producído un error y la aplicación no puede continuar funcionando." +
"¿Desea reiniciarla o finalizarla?");
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Reiniciar", new ReiniciarOnClickListener(iAct));
alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE,"Apagar", new ApagarOnClickListener(iAct));
alertDialog.show();
}catch(Exception e){
Thread.setDefaultUncaughtExceptionHandler(iDefaultHandler);
iDefaultHandler.uncaughtException(thread, ex);
}
}
All the code inside Try
block is executed, but the alert is never shown, and the screen stays grey.
In iDefaultHandler
I saved the result of getDefaultUncoughtException()
before seting mine.
Any information that is missing, please ask for it. I don't know how to solve this.