I have a ToggleButton that uses a selector to choose between 2 images (checked and unchecked).
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/img_piece1" /> <!-- pressed -->
<item android:drawable="@drawable/img_piece2" /> <!-- default/unchecked -->
</selector>
Is there a way to retrieve the current drawable resource (checked/unchecked) of the toggle button in code? I tried using the ToggleButton.getBackground(), however this only seems to return the default Drawable always.