OK, got it working - thanks for the help.

Couldn't get the AsyncTask onPostExecute to fire, so I used a
view.postDelayed - worked just fine.

Cheers!

On Aug 7, 9:49 pm, ZoobTheSimian <sam.gaw...@googlemail.com> wrote:
> Wow - fantastic.
>
> Thanks very much, Mark - that sounds spot on. I'm pretty new to
> Android (and Java, for that matter), so I'm still learning and I've
> just been banging my head against the wall on this one!
>
> I'll give it a try and update once it's resolved.
>
> Thanks again.
>
> On Aug 7, 8:54 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > ZoobTheSimian wrote:
>
> > > I've moved all the logic about whether the card should stay face-up or
> > > flip over again into a separate function, called in a new thread.
> > > Brilliant. Almost works great (the card shows its face), but it
> > > doesn't quite. For some reason, it's failing on the line
>
> > > ((ImageView) gridview.getChildAt(mIntFirstCardID)).setImageResource
> > > (R.drawable.cardback);
>
> > > I've done some debug, and it's finding the gridview object fine, it's
> > > finding the child imageview fine, it's finding the drawable ID fine,
> > > but it's still bugging out with "...has stopped unexpectedly".
>
> > > Any ideas? Is there some weird property on setImageResource which
> > > means I can't call it outside the main thread?
>
> > It's not a weird property -- anything you do that alters the UI has to
> > be done on the UI thread.
>
> > Consider using AsyncTask and putting the setImageResource() call in
> > onPostExecute(), or use any of the other "please run this on the UI
> > thread" techniques (View#post, Activity#runOnUiThread, Handler).
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Looking for Android opportunities?http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
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