open another activity when got a result "success" from php webservice But doesn't work, android -


i have used php webservice matching login credentials if true pass "success", if false pass "failure".

and in java code, matching result data , apply condition when open activity , when show toast wrong credentials.

but when put either wrong or right credentials open activity. never show toast

so please me , should ?

my code

 @override     protected void onpostexecute(string result) {         string str = result.trim();         if(str=="success") {             startactivity(new intent(login.this,mainactivity.class));         }         else{             toast.maketext(login.this, "either username or password not correct", toast.length_short).show();         }         dialog.dismiss();     } 

my php code

$sql = "select * master_login_tbl user_id = '$user' or email='$user' , password = '$pass' "; $result = mysql_query($sql); $check = mysql_fetch_array($result); $num_of_rows = mysql_num_rows($result); if($num_of_rows > 0){echo "success";}else{echo 'failure';} 

you need use str.equals("success"), comparing strings in java == not work because compare objects , not string.

you can use equalsignorecase("success)", which, name suggests, ignores upper or lower case differences.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -