Thanks, I was trying to keep the loading logic in the first activity and use the second only for displaying, hence the need to synchronize between the activities. Anyway, I ended up pushing the logic to the second activity (and passing the parameters through intent extras), so I guess I've skirted the synchronization issue (at least for now) - what you're suggesting in #2, I guess.
On Jan 11, 4:21 am, jwei512 <[email protected]> wrote: > I'm not sure what your code looks like, but some things you could try > are: > > 1) If you are using a thread to do all of the network calls, maybe > have something like > > while(!pageIsDone) { > sleep(1000); > > } > > // then display data > > And in your Activity class you can set the boolean pageIsDone to true > as soon as the necessary views have been loaded? Definitely probably > not the "preferred" way to do it though... > > 2) The "no thinker" way to do it would probably just be to start the > background thread after your UI display is done loading. I think this > is typically acceptable as your application will not timeout / ANR and > your user will not experience in "lag" in their experience of your > app. Note this can often be paired with some sort of progress dialog > to make it even "better" > > Not sure if this will help but maybe its a start? > > - jwei > > http://thinkandroid.wordpress.com > Examples, Code, and Tutorials > > On Jan 10, 9:10 pm, Sekhar <[email protected]> wrote: > > > > > I'd like to start an activity with some initial data (passed through > > Extras) that sets up a display page, while I simultaneously make a > > network call to get the rest of the data. I thought I'd pass this new > > data to the activity as a message to the activity's handler. Works > > fine. > > > Now, my question is: how can I make sure that the activity has > > finished drawing the page and is ready to show the message data? The > > data might come from the cache, so I'm worried the message may land in > > the handler before the page is ready to display it. > > > Is there a way to synchronize the page draw and the message handling? > > E.g., is it possible to suspend the looper till the page is ready? > > What's the preferred way of doing what I'm trying to do?
-- 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

