Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is most likely that you are running the splash screen (some sort of <a href="http://developer.android.com/reference/android/app/Dialog.html" rel="noreferrer">Dialog</a> such as <a href="http://developer.android.com/reference/android/app/ProgressDialog.html" rel="noreferrer">ProgressDialog</a> I assume) in the same thread as all the work being done. This will keep the view of the splash screen from being updated, which can keep it from even getting displayed to the screen. You need to display the splash screen, kick off an instance of <a href="http://developer.android.com/reference/android/os/AsyncTask.html" rel="noreferrer">AsyncTask</a> to go download all your data, then hide the splash screen once the task is complete.</p> <p>So your Activity's onCreate() method would simply create a ProgressDialog and show it. Then create the AsyncTask and start it. I would make the AsyncTask an inner class of your main Activity, so it can store the data it has downloaded to some variable in your Activity and close the ProgressDialog in its onPostExecute() method.</p> <p>Not sure how to elaborate anymore without just showing the code, so here it is:</p> <pre><code>public class MyActivity extends Activity { private ProgressDialog pd = null; private Object data = null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Show the ProgressDialog on this thread this.pd = ProgressDialog.show(this, "Working..", "Downloading Data...", true, false); // Start a new thread that will download all the data new DownloadTask().execute("Any parameters my download task needs here"); } private class DownloadTask extends AsyncTask&lt;String, Void, Object&gt; { protected Object doInBackground(String... args) { Log.i("MyApp", "Background thread starting"); // This is where you would do all the work of downloading your data return "replace this with your data object"; } protected void onPostExecute(Object result) { // Pass the result data back to the main activity MyActivity.this.data = result; if (MyActivity.this.pd != null) { MyActivity.this.pd.dismiss(); } } } } </code></pre> <p>Obviously there are some pieces you need to fill in there, but this code should run and give you a good starting point (forgive me if there is a code error, I don't have access to the Android SDK as I'm typing this currently).</p> <p>Some more good reading on the subject of AsyncTasks in Android can be found <a href="http://android-developers.blogspot.com/2009/05/painless-threading.html" rel="noreferrer">here</a> and <a href="http://jyro.blogspot.com/2009/11/android-asynctask-template.html" rel="noreferrer">here</a>.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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