in my Android App I use an AlertBox for selecting icons. This is done with a custom Adapter. I have a class comming from ImageView which changes the backgrond color for the old selected icon.
All works fine expect that I nees to reset the background color for converted views in the adapter. getBackGroundDrawable always return null? Any idea ???
public View getView(int position, View convertView, ViewGroup parent)
{
JIconImageView imageView = ((convertView == null) ? new JIconImageView(m_context) : (JIconImageView)convertView);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setPadding(2, 2, 2, 2);
imageView.setIsSelected(m_selected == position);
imageView.setImageResource(JEntryIconHelper.getIconFromIndex(position));
return imageView;
}
and from public final class JIconImageView extends ImageViewenter code here
public void setIsSelected(boolean bSelected)
{
if (m_bSelected = bSelected)
setBackgroundColor(SELECTED_BACKCOLOR);
else setBackgroundDrawable(m_background);
}