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

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -