Along with this Raghav's advice,

Android has a good amount of support for Threading utilities that take
care of some of the dirty stuff for you, it's a nice alternative that
meshes well with the framework (contrast to a "Thread" object).  You
can check out AsyncTask,  which might do what you want in this case,
and makes threading a little less painful..

http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html

Kris

On Sun, Dec 18, 2011 at 7:41 AM, Raghav Sood
<[email protected]> wrote:
> You would need to use a Runnable for this. Googling this would help you get
> some example code.
>
> If you are this new to all of this, I would recommend learning Java and then
> coming to Android.
>
> Thanks
>
> Raghav Sood
> Sent from my Nexus S
>
> On Dec 18, 2011 12:13 PM, "QuR" <[email protected]> wrote:
>>
>> Hello Raghav,
>>
>> thanks for responding. How would I use "runOnUiThread" ? Do you have a
>> little example for me?
>> Sorry for asking so stupid, I am quite new to java/android, but do I
>> have to use this "runOnUiThread" from within the threads run() method?
>>
>> Regards
>> Rainer
>>
>> On 18 Dez., 12:47, Raghav Sood <[email protected]> wrote:
>> > Try using runOnUiThread().
>> >
>> > Thanks
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Sun, Dec 18, 2011 at 5:08 PM, QuR <[email protected]> wrote:
>> > > Hello,
>> >
>> > > how can I access the UI from a other thread?
>> >
>> > > My scenario:
>> > > in my activity I create and start a thread, which continously has to
>> > > do various tasks in the background. On some of this tasks it is
>> > > necessary to update the UI. To do this I am calling a method in my
>> > > Task. The problem no is, that this method is called in the context of
>> > > the thread and that I am not allowed to access the UI controls.
>> > > How can I now synchronize with the UI thread to be allowed to update
>> > > the UI controls?
>> > > In C# there are things like "Dispatcher.Invoke(action)", but how do I
>> > > do this with Java/Android?
>> >
>> > > Thanks for any help and hints!
>> >
>> > > Regards
>> > > Rainer
>> >
>> > > --
>> > > 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
>> >
>> > --
>> > Raghav Soodhttp://www.androidactivist.org/-
>> > Authorhttp://www.appaholics.in/- Founder
>>
>> --
>> 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
>
> --
> 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

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

Reply via email to