Hi, I am trying to use that small favorite icon (the Android star icon, android:drawable/btn_star), which according to its XML definition has several distinct states in which it looks different (e.g. it's a golden filled star when checked, and a grey unfilled star when unchecked).
Whenever the ImageView rendering that drawable receives a click event, I want to switch those two states. Here is what I do: starIcon.setOnClickListener(new OnClickListener() { public void onClick(View v) { Drawable star = starIcon.getDrawable(); int[] currentState = star.getState(); System.out.println(StateSet.dump(currentState)); if (StateSet.stateSetMatches(currentState, android.R.attr.state_checked)) { System.out.println("is checked"); star.setState(new int[] { android.R.attr.state_enabled }); } else { System.out.println("not checked"); star.setState(new int[] { android.R.attr.state_checked }); } star.invalidateSelf(); } }); however, the onclick handler always enters the else clause and the dump always prints W P E, which means that the call to setState (checked) has no effect... I guess? What am I missing? Thanks, Matthias --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---