The method really depends on your requirements: * If the amount of work isn't too great, and you just want the activity to be drawn before the processing starts, then postDelayed() is a sensible approach.
* If you have a lot of processing to do, and the execution needs to be linear (e.g. (a) must finish before (b) which must finish before (c)) , then an ASyncTask or Runnable would allow that to happen without interfering with the activity event loop. * If you have a lot of processing to do, but want to split it up into lots of asynchronous background tasks (and execution order is less of an issue), then using a message queue would be more manageable. If you're unsure which one you will need, then a postDelayed() is a simple approach to start off with. You could extract intensive work into background threads later on. On Thu, Jan 7, 2010 at 5:53 AM, Kevin Duffey <andjar...@gmail.com> wrote: > Couldn't you spawn a thread to do the work, then put a Runnable on the UI > thread to do the actual updating of the UI? > > On Wed, Jan 6, 2010 at 9:08 AM, skink <psk...@gmail.com> wrote: >> >> >> On Jan 6, 1:52 pm, "Mark Murphy" <mmur...@commonsware.com> wrote: >> > > I do a setContentView(R.layout.main); in my onCreate, but have a ton >> > > of other things to do before the onCreate >> > > finishes...and it take a lot of time for anything to show up on the >> > > display. >> > > Is there an easy way just to have the layout at least pop up then get >> > > filled so I don't have the delay? >> > >> > Delay the extra work you have in onCreate() to a later point. For >> > example, >> > use Handler#postDelayed() to have that work be done after 200ms, to >> > allow >> > Android to draw your layout. >> > >> > -- >> > Mark Murphy (a Commons Guy)http://commonsware.com >> > Android App Developer Books:http://commonsware.com/books.html >> >> hi, >> >> i'd use >> >> http://developer.android.com/intl/fr/reference/android/os/MessageQueue.html#addIdleHandler(android.os.MessageQueue.IdleHandler) >> >> pskink >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Beginners" group. >> >> NEW! Try asking and tagging your question on Stack Overflow at >> http://stackoverflow.com/questions/tagged/android >> >> To unsubscribe from this group, send email to >> android-beginners+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-beginners?hl=en >> > > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > >
-- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en