Android onPreExecute cannot show a ProgressDialog -
so, have asynctask
below:
private class asyncretriever extends asynctask<iotdhandler,void,iotdhandler>{ progressdialog pdialog; @override protected void onpreexecute(){ pdialog = new progressdialog(getapplicationcontext()); pdialog.setmessage(getresources().getstring(r.string.toast_msg1)); pdialog.show(); } //------------------------------------------------------------------------------
this inner class of mainactivity
. however, logcat flags pdialog.show()
error.
says, unable start activity componentinfo.
how solve this?
a progressdialog needs activity context. try this:
pdialog = new progressdialog(youractivity.this);
Comments
Post a Comment