private void handleNetworkException(Exception exception) { if (exception instanceof AuthenticationException) { MessageBox.Show( this, getString(R.string.authentication_error_title), getString(R.string.authentication_error), new Callback<Void>() { public void doStuff(Void param) { restart(); } }); } else if (exception instanceof ServerException) { MessageBox.Show( this, getString(R.string.server_error_title), getString(R.string.server_error), null); } else if (exception instanceof CryptoException) { MessageBox.Show( this, getString(R.string.decryption_error_title), getString(R.string.decryption_error), null); } else if (exception instanceof IOException) { return; } else { MessageBox.Show(this, "Error", "What happen", null); } }