Note that there are some explanatory texts on larger screens.

plurals
  1. POwhen don't keep activities selected on Setting , progress dialog is not dismissing
    text
    copied!<p>when "don't keep activities" is selected on Setting's Developer Options progress dialog is not dismissing. Actually, I am displaying the Progerss bar,for initialize the Application, When I am going to Activity A to Activity B and then came to Activity A, the Progress bar is not dismissing after initialize completed. Below is my Code,</p> <p>First Activity</p> <pre><code>package com.example.donotkeepactivitiesalive; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { public static final int MESSAGE_PROGRESS_BAR_INITIALIZING = 1; private Dialog m_cObjDialog; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); System.out.println(getClass().getName() + "before InitializeEnvironment &gt;&gt;&gt;&gt;&gt;&gt;"); new InitializeEnvironment().execute(); System.out.println(getClass().getName() + "after InitializeEnvironment &gt;&gt;&gt;&gt;&gt;&gt;"); Button lb = (Button) findViewById(R.id.button1); lb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent lIntent = new Intent(MainActivity.this, SecondActivity.class); startActivity(lIntent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override protected Dialog onCreateDialog(int id) { m_cObjDialog = new ProgressDialog(this); m_cObjDialog.setTitle("Initializing"); ((ProgressDialog) m_cObjDialog).setMessage("Initializing the Application"); m_cObjDialog.setCancelable(false); return m_cObjDialog; } class InitializeEnvironment extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { System.out.println(getClass().getName() + "onPreExecute &gt;&gt;&gt;&gt;&gt;&gt;"); super.onPreExecute(); showDialog(MESSAGE_PROGRESS_BAR_INITIALIZING); } @Override protected String doInBackground(String... aurl) { System.out.println(getClass().getName() + " doInBackground &gt;&gt;&gt;&gt;&gt;&gt;"); return null; } @Override protected void onPostExecute(String unused) { dismissDialog(MESSAGE_PROGRESS_BAR_INITIALIZING); System.out.println(getClass().getName() + " onPostExecute &gt;&gt;&gt;&gt;&gt;&gt;"); } } } </code></pre> <p>Second Activity </p> <pre><code>package com.example.donotkeepactivitiesalive; import android.app.Activity; import android.os.Bundle; public class SecondActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } </code></pre> <p>Is there any way to track this problem and work even if "don't keep activities" is enabled</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload