Note that 'post' and 'runOnUiThread' takes a Runnable and it should
*not* be a Thread (although that implements Runnable as well)! (Mis)
using a Thread for this is not good. Just use a Runnable.

Create a new instance of a Runnable and implement its 'public void run
()' method (see my example code in my previous post).

On Jan 21, 4:50 pm, TreKing <treking...@gmail.com> wrote:
> On Thu, Jan 21, 2010 at 3:30 PM, Dirk Vranckaert
> <dirkvrancka...@gmail.com>wrote:
>
> > It seems your solution does not work either.
>
> Um ... it should, I've used this technique repeatedly. Can you post the code
> you're using?
>
> > As long as I'm doing it in a thread it doesn't work.
>
> Well, it depends on how you're running the thread. If you're posting it to
> the runOnUiThread() function, it should work. If you're starting it with
> Thread.start(), then yeah, that won't work. Again, some code would clarify.
>
> > Altough what I tried next was setting the error message for the user
> > in my catch clause. And right after the thread finished I handled the
> > showing of the errors based on wheater some error message was set or
> > not!
>
> I'm not sure I follow here.
>
> > Thx for your help! (If you get me some advanced explanation on why
> > dialogs cannot be created from within a thread plz let me know!)
>
> Probably because of the complexities of ensuring thread safety. If you could
> update the UI from any thread, you could run into various threading issues
> (deadlocks, race conditions, etc). If they core framework were designed to
> support this it would introduce more complexity and overhead to the system.
> Just a guess, but again, this is pretty standard behavior in GUI systems, so
> it's really something that's just accepted.
>
> ---------------------------------------------------------------------------­----------------------
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
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