I have looking for posts that would help me in implementing a custom check box.I have a checkbox for determining whether its a favourite or not and using two different custom icons for displaying the state.I have used small int as datatype(0 or 1) to determine whether favourite or not.I have tried using onclicklistener as well as oncheckchangelistener,but no luck.
This is my drawable
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ic_action_important" android:state_checked="false"/>
<item android:drawable="@drawable/ic_action_important_holo_dark" android:state_checked="true"/>
<item android:drawable="@drawable/ic_action_important_holo_dark" android:state_pressed="true"/>
<item android:state_focused="true"
android:drawable="@drawable/ic_action_important_holo_dark" />
<!-- <item android:drawable="@drawable/ic_action_important"/> -->
</selector>
when its 1 I tried setting it to chkbox.setchecked(true) and if 0 to chkbox.setchecked(false).But this doesnt seem to be working.Any mistakes in my logic?? Plz do help.Thanks in advance.
0 comments:
Post a Comment