I m using AsyncTask in my custom Dialog. AsyncTask works fine in activity, but inside dialog doesn t show ProgressDialog. Tried do privid context from dialog, from activity who showed dialog, app context. Result is same: no ProgressDialog shown on my screen.
private class ClearCache_Task extends AsyncTask<Integer,Integer,Integer>
{
private ProgressDialog progressBar;
private ArrayList<String> m_subfolders;
private final Context m_con;
public ClearCache_Task(Context con, ArrayList<String> subfolders)
{
m_con = con;
m_subfolders = subfolders;
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
progressBar = new ProgressDialog(m_con);
progressBar.setIndeterminate(true);
progressBar.setCancelable(false);
progressBar.setMessage("Please wait...");
progressBar.show();
}
@Override
protected void onPostExecute(Integer result)
{
super.onPostExecute(result);
progressBar.dismiss();
}
@Override
protected Integer doInBackground(Integer... params)
{
try
{
m_KFileStorage.ClearCache(m_subfolders);
}
catch (Exception e)
{
e.printStackTrace();
Log.e(AppTag, e.toString());
}
return 0;
}