我已经做了一个应用程序,在其帐户中的用户日志。对于这个我已经使用asyncTask.Everything工作正常,但事情是当我得到的响应我希望进度条停止。但它继续汽车无。ProgressBar不会停止
异步任务
protected void onPreExecute() {
super.onPreExecute();
CommonFunctions.showProgress (c, "Please Wait", true);
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute (s);
try {
JSONObject jsonObject = new JSONObject (s.trim());
JSONObject NewDataSet = jsonObject.getJSONObject ("NewDataSet");
JSONObject Table = NewDataSet.getJSONObject ("Table");
String User_ID = Table.getString ("User_ID");
String Vendor_IEntity_Code = Table.getString ("Vendor_IEntity_Code");
String Vendor_Name = Table.getString ("Vendor_Name");
// setting the preferences
SettingPreference.setUserId (c, User_ID);
SettingPreference.setVendorId (c, Vendor_IEntity_Code);
SettingPreference.setVendorName (c, Vendor_Name);
} catch (JSONException e) {
e.printStackTrace();
}
CommonFunctions.showProgress (c, "", false);
Crouton.makeText ((android.app.Activity) c, "Login Sucessful", Style.CONFIRM).show();
}
@Override
protected String doInBackground(String... strings) {
response = HttpRequest.post ("https://beta135.hamarisuraksha.com/web/WebService/HsJobService.asmx/IsUserValid").send ("_UserID=" + strings[0] + "&_Password=" + strings[1]).body();
Log.e ("Login Response", "" + response);
return response;
}
CommonFunctions
public class CommonFunctions {
private Context c;
public static void showProgress(Context context, String message, boolean isVisible) {
ProgressDialog progressDialog = new ProgressDialog (context);
progressDialog.setMessage (message);
progressDialog.setCancelable (false);
if (isVisible) {
progressDialog.show();
} else if (isVisible == false) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
}
}
三江源它的工作如此之多: ) – Anuj
@ user3667909欢迎您+1,如果有帮助谢谢,请点击此处。 –
@Rod_Algonquin也+1我从... –