starting an activity from a background thread

756 views
Skip to first unread message

achim

unread,
Sep 10, 2010, 4:03:01 AM9/10/10
to cw-android
Hi Mark,

in your Advanced... book in the chapter about threads you write 'You
cannot modify any part of the UI from a background thread'.
What about starting an activity from a background thread? I don't see
any exception thrown and it seems to work fine, so there is one
occurrence where all the code gets executed but the UI of the activity
that got started from the background thread never shows up. Any
thoughts on this?
If I start an activity that way, does the OS put the activity on a
queue for the UIThread?

Achim

Mark Murphy

unread,
Sep 10, 2010, 6:27:12 AM9/10/10
to cw-an...@googlegroups.com

I have not attempted to start an activity from a background thread -- sorry.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://skillsmatter.com/go/os-mobile-server

Fred Medlin

unread,
Sep 10, 2010, 9:07:29 AM9/10/10
to cw-an...@googlegroups.com
I have an app that regularly starts activities from a background thread and everything works just fine, so maybe your UI problems are unrelated. You could test that by using another level of indirection; create a Runnable that starts the activity and schedule the Runnable on the UIThread.

Fred

--
You received this message because you are subscribed to the Google Groups "cw-android" group.
To post to this group, send email to cw-an...@googlegroups.com.
To unsubscribe from this group, send email to cw-android+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cw-android?hl=en.


Reply all
Reply to author
Forward
0 new messages