I am trying to change tab icon when state changes. All is working properly if I use drawable from following xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/d_selected"
android:state_selected="true" />
<item android:drawable="@drawable/d_normal" />
</selector>
However, now I need to load images from data/data folder and drawables "d" and "dSel" are generated from these images. Using following code only "dSel" is shown and other tab images does not appear! Thank you
ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
selector.addState(new int[]{ android.R.attr.state_pressed }, d);
selector.addState(new int[]{ android.R.attr.state_selected }, dSel);
selector.addState(new int[]{ android.R.attr.state_focused }, d);
icon.setImageDrawable(selector);
//icon.setImageResource(drawableId); used with other method described, if related to xml