In my activity I did not use any asynctask. The purpose of the activity is to load data from api to sqlite database. Thus I used LoadData() on oncreate() of my activity. I want to implement progress dialogue while loading data that means time to load information. I used this
pd = new ProgressDialog(OpeningActivity.this, ProgressDialog.STYLE_SPINNER);
pd.setIndeterminate(true);
pd.show(OpeningActivity.this, AppConstants.WAITTAG, AppConstants.WAITDET);
To finish progressDlg: There are few if else cases in my activity. Based on which I finished dialogue activity and called new activity intent like this
if (db.isTableExists(db3,EDU_PROVIDER_TABLE)){
pd.dismiss();
Intent a = new Intent(getApplicationContext(),PlaceChoiceActivity.class);//Default Activity
a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//getApplicationContext().startActivity(a);
(getApplicationContext()).startActivity(a);
this.finish();
}
My logcat
ctivity.OpeningActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41dfc8f0 V.E..... R.....ID 0,0-480,243} that was originally added here
android.view.WindowLeaked: Activity demo.kolorob.kolorobdemoversion.activity.OpeningActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41dfc8f0 V.E..... R.....ID 0,0-480,243} that was originally added here
I tried to replaceOpeningActivity.this with getApplicationContext() or this or getActivity() also tried to pass context which threw exception as can not cast android.app.application can not cast to android.app.activity