Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Load Data in background during splash screen and use it later
    primarykey
    data
    text
    <p>I'm trying to load data from a webserver (getting a JSONArray back) during the start of my application. So far I was able to get the array back only from the main activity with the following commands: <br></p> <pre><code>if (DEVELOPER_MODE) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build());&lt;br&gt; } jsonArray = JsonParser.getJSONFromURL("cities2.php"); </code></pre> <p><br> <br> That gave me all the cities (or whatever data i needed) in the current class, but this is not a clean way to do it.. <br>My Problem now is, how to get the cities from my SplashScreen Activity to the Activity where i need the data.<br><br>My goal is to load all the data from the webserver during the SplashScreen (about 4500 lines of text -> approx. 50KB data) and use them in the different Activities.. <br><br> So, my main problem at the moment is how to get the data from the webserver that i load during the SplashScreen onto the "last" activity (i.e. SplashScreen -> MainActivity -> SetFilterActivity -> ShowDataActivity (here i need the data) )</p> <p>I was reading here; <a href="https://stackoverflow.com/questions/1979524/android-splashscreen">Android SplashScreen</a><br> Here: <a href="https://stackoverflow.com/questions/2222890/how-to-make-a-splash-screen-screen-visible-when-app-starts">How to make a splash screen (screen visible when app starts)?</a> <br> Here: <a href="http://www.androidpeople.com/android-loading-welcome-splash-spash-screen-example" rel="nofollow noreferrer">http://www.androidpeople.com/android-loading-welcome-splash-spash-screen-example</a> <br> And here: <a href="http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1" rel="nofollow noreferrer">http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1</a> <br> And others.... :-)</p> <p>I tried also to write a sperate class that extends Application and "store" the data in there (getters and setters), but somehow it does not work like i want.</p> <p>Can anyone guide me into the right direction on how i can do that a proper way.. </p> <p>Thank you for your help</p> <p>PS: I could easily load the data on each screen whenever i need it, but i want to load it at one point and just use it afterwards in the programm whenever and wherever i need it</p> <p>PSPS: stackoverflow is the best ;-) . The last few weeks im all the time here to look for help and hints</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.
 

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