**Updated: (See below)**I have been looking around for couple of days and can\'t find a straight answer to this. Some say it possible to some say to accomplish some say it\
You were creating the ProgressDialog with a null context. The following code worked for me.
public class AsyncClass extends AsyncTask {
private Context context;
ProgressDialog dialog;
public AsyncClass(Context cxt) {
context = cxt;
dialog = new ProgressDialog(context);
}
@Override
protected void onPreExecute() {
dialog.setTitle("Please wait");
dialog.show();
}
@Override
protected Void doInBackground(Void... unused) {
SystemClock.sleep(2000);
return (null);
}
@Override
protected void onPostExecute(Void unused) {
dialog.dismiss();
}
}