I've a ListView and when my audio is paused I draw a LayerDrawable to show progress of how much was played. The problem is when I sroll this ListView element off the screen and get it back - I don't see any of the Image back there.
This is part from the adapter :
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
allView=convertView;
if (view == null) {
view = lInflater.inflate(R.layout.item, parent, false);
}
............
switch (whatToDo) {
//here's my normal state of the Image
case 0 :
((ImageView) view.findViewById(R.id.ivImage)).setImageResource(p.imagestatus);
break;
//here's my Paused state of the Image - what I need to stay on the screen
case 1:
Log.e ("MyLog","paused! imagestatus="+p.imagestatus);
//Drawing progress
LayerDrawable ld= (LayerDrawable) ctx.getResources().getDrawable(R.drawable.onpause);
ClipDrawable cd=(ClipDrawable) ld.findDrawableByLayerId(R.id.clip_pause);
p.imagestatus=-p.imagestatus;
cd.setLevel(4500+(30*p.imagestatus));
((ImageView) view.findViewById(R.id.ivImage)).setImageDrawable(ld);
break;
...
return view;
}
so, as you see, pretty much , usual getView method. But when this Image goes off the screen - it never come back. How can I fix it?