AsyncTask can help, but on single-core devices AsyncTask will at times block your UI loading code. I've have experienced this with loading images and data from a SQLiteDatabase. I would suggest starting up an AsyncTask to load your data in onResume or onStart. That way you have a pretty high chance of the user seeing your UI, and then the long time-consuming operation starting. I don't know where your "items" will be loaded in, but I had a similar situation in which I loaded data into items in a List. I wrapped the List in a ViewSwitcher that contained a ProgressDialog and the List. While the data was being loaded, the ViewSwitcher was set to display the ProgressBar. Once the data was loaded, the ViewSwitcher displayed the List.
On Aug 13, 7:38 am, nadam <[email protected]> wrote: > Use AsyncTask.http://developer.android.com/reference/android/os/AsyncTask.html > > On 12 Aug, 06:21, gml <[email protected]> wrote: > > > > > > > > > Hi guys, > > > I have simple application that loading the data needed upon the > > Activity starts which it consume about 2-3 minutes. Then, the UI > > displayed after that long process. > > > Present Scenario: > > 1) click the app to start. > > 2) progress bar pop-up while doing the data loading in my localDB > > (about 2-3mins). > > 3) progress bar closes, UI start to load and display the data from > > localDB. > > > Problem: > > Want to start and load/display the UI immediately while loading the > > data into localDB but display it one by one. > > But don't have idea on how to implement it. > > > Expected Scenario: > > 1) click the app to start. then immediately load and display the UI. > > 2) on the background, get the data and load to localDB while > > displaying it one by one to UI. > > > Thanks and regards, > > > Eros > > Japan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

