tags:

views:

14

answers:

0

I'm trying to display a RatingBar View that is only capable of showing a one star rating, or no stars. This seems so trivial...

My ratingbar is defined like so:

My view implements OnRatingBarChangeListener and OnTouchListener

My OnRatingBarChange handler has no code. My OnTouch handler looks like so:

@Override
public boolean onTouch(View v, MotionEvent event)
{
    if(event.getAction() == MotionEvent.ACTION_DOWN)
    {
        if(this.mRating.getRating() == 0)
        {
            this.mRating.setRating(1);
        }
        else
        {
            this.mRating.setRating(0);
        }
        return true;
    }
    return false;
}

No matter what, the onTouch event does not succeed at setting the rating back to zero. This seems way too trivial. What am I doing wrong?

Thanks!