In this code else if
part is not working . toast
is not appearing if login failed .
my code
try {
s= json.getString("info");
Log.d("Msg", json.getString("info"));
if(s.equals("success")) {
Intent login = new Intent(getApplicationContext(),MainPage.class);
login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(login);
finish();
} else if(s.equals("fail")) {
Toast.makeText(getParent(),"Login Failed",
Toast.LENGTH_SHORT).show();
((EditText) findViewById(R.id.user)).setText("");
((EditText) findViewById(R.id.pwd)).setText("");
finish();
}
Aucun commentaire:
Enregistrer un commentaire