if(!running)
{
running=true;
boolean connected=checkNet();
if(connected)
{
progressDialog = new ProgressDialog(getActivity());
progressDialog.setCancelable(false);
progressDialog.setMessage("Swalpa taalme.." +
"\n" +
"ಸ್ವಲ್ಪ ತಾಳ್ಮೆ");
progressDialog.show(); //ProgressDialog
final JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, URL_DATA,null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray a=response.getJSONArray("heroes");
for(int i=0;i<a.length();i++)
{
JSONObject obj=a.getJSONObject(i);
ListItem m = new ListItem();
m.setHead(obj.getString("name"));
m.setDesc(obj.getString("about"));
m.setImageUrl(obj.getString("image"));
m.setTrailer(obj.getString("trailer"));
listItems.add(m);
adapter = new MyNewAdapter(activity,listItems);
horizontalInfiniteCycleViewPager.setAdapter(adapter);
}
adapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
progressDialog.dismiss(); //Getting error here
running=false;
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(getActivity().getApplicationContext(),"Sorry, something went wrong",Toast.LENGTH_LONG);
running=false;
}
});
queue.add(jsObjRequest);
}
else running=false;
}
请帮帮我。取消查看进度条上没有附加查看。
查看未附加在进度条上的装饰()。解雇。 DecorView @ f4c156 []未附加到progressBar.dismiss()上的窗口管理器 查看装饰栏上未附加装饰()。解雇。
答案 0 :(得分:0)
尝试
progressDialog = new ProgressDialog(getContext());