Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display progress dialog before starting an activity
    primarykey
    data
    text
    <p>How can I install a rotating progress bar (or dialog) during long transition between activity's? I've seen solutions with help realize AsyncTask - I did as mentioned in a post the link will <a href="https://stackoverflow.com/questions/5202158/how-to-display-progress-dialog-before-starting-an-activity-in-android">How to display progress dialog before starting an activity in Android?</a> , but the problem is that the progress bar is not spinning. </p> <pre><code>package expir.java.file; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.Button; public class ExpirActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); Button mapButton = (Button)findViewById(R.id.first_button); mapActivityIntent = new Intent(this, MyMapActivity.class); pDialog = new ProgressDialog(this); mapButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { pDialog.setMessage("Loading..."); new MyTask(pDialog).execute(); } }); Button downloadButton = (Button)findViewById(R.id.second_button); downloadButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { as.DownloadFromUrl("0", "null");; } }); Button parseButton = (Button)findViewById(R.id.third_button); parseButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SAXParserCreateDataBase gi = new SAXParserCreateDataBase(); try { gi.start(ExpirActivity.this); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); Button updateButton = (Button)findViewById(R.id.fourth_button); updateButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SAXParserCreateDataBase gi = new SAXParserCreateDataBase(); try { gi.update(ExpirActivity.this); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); } public class MyTask extends AsyncTask&lt;Void, Void, Void&gt; { public MyTask(ProgressDialog progress) { this.progress = progress; } public void onPreExecute() { progress.show(); } public Void doInBackground(Void... unused) { startActivity(mapActivityIntent); return null; } public void onPostExecute(Void unused) { progress.dismiss(); } ProgressDialog progress; } DownloadPrimaryDate as = new DownloadPrimaryDate(); Intent mapActivityIntent; ProgressDialog pDialog; } </code></pre> <p><strong>UPDATE:</strong> <p>LogCat results:</p></p> <p>FirstActivity.onCreate()</p> <p>FirstActivity.onStart()</p> <p>FirstActivity.onResume()</p> <p>FirstActivity.onPause()</p> <p>SecondActivity.onCreate()</p> <p>SecondActivity.onStart()</p> <p>SecondActivity.onResume()</p> <p>FirstActivity.onStop()</p> <p><strong>This explains why there is so.</strong></p> <p><strong>UPDATE<br> In my realize what I was thinking - not all of my attempts to implement this transition between the activity were even.</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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