I have a Asynctask
that basically performs the task of Login and when the credentials are correct and pass the following Activity mustre a message of type Snackbar
I share the method where I think it should go ...
protected void onPostExecute(String result) {
// este método se ejecutará en el subproceso de la interfaz de usuario
pdLoading.dismiss();
if(result.equalsIgnoreCase("true"))
{
// si sale bien el proceso y se legea correctamente pasa a la activity menuexpositor y finaliza login expositor
// para que no pueda volver atras. sino que volvera el menu princial
final String email = etEmail.getText().toString();
Toast.makeText(getApplicationContext(),"Bienvenido/a: "+email,Toast.LENGTH_SHORT).show();
Intent intent = new Intent(formularioExpositor.this,MenuExpositor.class);
startActivity(intent);
formularioExpositor.this.finish();
}else if (result.equalsIgnoreCase("false")){
final AlertDialog.Builder alertaDeError = new AlertDialog.Builder(formularioExpositor.this);
alertaDeError.setTitle("Error");
alertaDeError.setMessage("Credenciales incorrectas.");
alertaDeError.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alertaDeError.create();
alertaDeError.show();
} else if (result.equalsIgnoreCase("exception") || result.equalsIgnoreCase("unsuccessful")) {
final AlertDialog.Builder alertaDeError2 = new AlertDialog.Builder(formularioExpositor.this);
alertaDeError2.setTitle("Error");
alertaDeError2.setMessage("Ha ocurrido un error inesperado. Intente nuevamente. Verifique su conexión a Internet");
alertaDeError2.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alertaDeError2.create();
alertaDeError2.show();
}
}
As you can see I'm using a Toast
to show the message. Any suggestions?