Hi l,

Please read the docs for AsyncTask.
You don't want to do UI work within doInBackground. Try onProgressUpdate and
onPostExecute instead.

Cheers,
James

On Tue, Oct 6, 2009 at 2:52 AM, Ivru <ivruij...@gmail.com> wrote:

>
> Hello.
>
> Getting start with Android, I'm trying to create a "Game of life"
> software. My application has a TableLayout filled with ImageView for
> each cell. I'm trying to run/stop the game once a button has been
> click (same button for both). Anyway, what I'm trying to do is to
> change my GUI from the thread that run the game. I cannot change the
> GUI from a new thread. Ok.
>
> Then I'm trying to use the AsyncTask class to avoid this problem.
> Using this mechanism, I still get a "android.view.ViewRoot
> $CalledFromWrongThreadException: Only the original thread that created
> a view hierarchy can touch its views" Exception.
>
> I'm really stuck and lost with this, any help would be more than
> welcome.
>
> Here is the revelant code: http://fr.pastebin.ca/1597363
> The Exception is raised in the method drawBoard when I try to set the
> image of the ImageView.
>
> Thanks.
>
> I.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to