Brian Conrad wrote: > To be even more precise it is one string with carriage returns. The > data is calculated by the program. The layout is in XML and handling > the interface programmatically won't make a difference. This only takes > 4-5 seconds but I still want a some kind of indicator of that. This > string is part of the main display about 40 rows worth so we have to > wait for them.
4-5 seconds to generate 1-2K worth of string data seems like a lot, but I'll take it on faith that it really does need to take that long. > I'll play around with some threads though and see what happens Pretty much anything Android can offer in the way of progress indication support requires a background thread, whether explicitly created by you or implicitly created by a framework (e.g., 1.5's AsyncTask). If the whole UI is pointless until the string is generated, you can use a trick I applied in one project. In that case, a designer wanted to display some content in a full-screen WebView which took a few seconds to load up. Based on the designer's requests, I went with the following: 1. Used a FrameLayout to have both a full screen WebView and a full-screen ImageView, one atop the other 2. Had the WebView flagged as invisible (android:visibility="invisible") and loaded a round image in the ImageView 3. Used a RotateAnimation on the ImageView to simulate indefinite progress 4. When the WebView reported the page was loaded, I stopped the animation, made the ImageView invisible, and made the WebView visible Via this pattern, your user is not exposed to the half-baked UI until you have had a chance, in a background thread, to build the data to flesh out the rest of the UI. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

