每次得到来自else块的结果都不能得到来自if块的所有时间显示来自else块的结果,如何解决这个问题请帮帮我。这是我的String Url: http://duraent.net/android_order_app/api/android/updateDoctorOtpStatus.php?otp_id=5670&e_mail=test@gmail.com
我的代码:
private class GetDoctorResultForFinal extends AsyncTask<String, String, String> {
Http_Doctor_Final_Submit doctorfinalrequest = new Http_Doctor_Final_Submit();
Context ctx;
String latLong_url;
ProgressDialog pd;
private String result;
public GetDoctorResultForFinal(View.OnClickListener _ctx, String _latong_url) {
ctx = (Context) _ctx;
latLong_url = _latong_url;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
pd = new ProgressDialog(Doctor_Regi.this);
pd.setMessage("loading");
pd.show();
}
@Override
protected String doInBackground(String... params) {
if (CC7.iNa(ctx)) {
Log.d("Request : ", "starting");
String result = doctorfinalrequest.makeHttp_Doctor_Final_Request(latLong_url, "GET", null);
Log.d("Request Login attempt", result.toString());
return result.toString();
} else {
return "Internet Not Available";
}
}
@Override
protected void onPostExecute(String result) {
pd.dismiss();
try {
Log.d("Request : 2 ", "" + result);
if (result.equals(true)) {
Toast.makeText(Doctor_Regi.this, "You Have Submited Successfully", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Doctor_Regi.this, DuraentMenu.class);
startActivity(intent);
}
else {
Toast.makeText(Doctor_Regi.this, "INVALID OTP", Toast.LENGTH_SHORT).show();
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
答案 0 :(得分:0)
使用 if(result.equals(&#34; true&#34;))
答案 1 :(得分:0)
如果你的方法 doctorfinalrequest 返回String &#34; true&#34; ,你必须更新:
if (result.equals("true"))