Thanks for the reply Beth.  I'll take a look at the ImageSwitcher.

Since posting this, I found a workaround that seems to work. Basically
I do the face up flip, and then send a message to the activity.  The
message handler does the face down flip like this. Here is some of the
code:

    private OnClickListener myCardImageListener = new OnClickListener
() {
        public void onClick(View v)
        {
           ...
           CardImageView iv_1 = deck[CardNum];
           if (iv_1.CardState == CARD_STATE_UP)
           {
              iv_1.DoCardPress();
              WaitSeconds(1);
              handler.sendMessage(handler.obtainMessage
(MESSAGE_HIDE));
           }
           ...
        }
     }

     Handler handler=new Handler()
     {
        public void handleMessage(Message msg)
        {
           ...
           if (msg.what == MESSAGE_HIDE)
           {
              CardImageView iv_1 = deck[CardNum];
              iv_1.DoCardPress();
           }
           ...
         }
      };


On Jan 13, 12:20 pm, Beth <[email protected]> wrote:
> Since you have exactly two images, face down and face up, you might
> try out an ImageSwitcher object.  Toggle the image with show next and
> skip the validation business.
>
> On Jan 13, 7:00 am,GreggReno<[email protected]> wrote:
>
> > I am working on a card game, and using a custom ImageView for the
> > cards.  I have an OnClickListener that handles the presses on the
> > cards.
>
> > What I want to happen is in some cases is:
> > - User presses a face down card
> > - Card displays face up
> > - Wait 1 second
> > - Card displays face down
>
> > Within the OnClickListener , I draw the face up card, call invalidate,
> > use Thread.currentThread().sleep(1000), draw the card face down, and
> > call invalidate again.  What happens is you never see the card face up
> > - just face down.
>
> > From what I understand from prior threads, this is expected behavior
> > as invalidate won't re-draw immediately, so you only wind up seeing
> > that last thing drawn. The view is probably being re-drawn after
> > exiting the OnClickListener.
>
> > So, any suggestions for accomplishing this using a different method?
>
> > Thanks,
> > -Gregg
>
>
-- 
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