Yeah I don't bother ever checking if I'm in the UI thread or not,
whenever it's an issue I just either spawn a new thread (for things I
don't want on the UI thread), or I explicitly start the execution onto
the UI thread.  It's simpler to put it on the path you want then to
check if you are already on it.

I like the UI method were you do very little work on the UI thread.  I
like to return immediately from onCreate with something, but start a
thread to do all my calculations, etc.  At the same time I try to keep
the number of threads low, basically one worker thread for each
activity.  Maybe one more thread for network calls.

My 2 cents,
-MK



On Jul 15, 7:56 am, TreKing <treking...@gmail.com> wrote:
> On Thu, Jul 15, 2010 at 8:15 AM, guich <guiha...@gmail.com> wrote:
> > Hey, what about answering the original question?
>
> There's not built in way to do this, AFAIK. You could probably get away with
> saving a reference to the current thread in onCreate or somewhere you know
> is running in the main thread, then comparing against that. This is probably
> overkill.
>
> --------------------------------------------------------------------------- 
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

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

Reply via email to