I have a map of <CheckBox, ImageButton>.
I want to be able to iterate over this map and change the image of each ImageButton. Is there any way I can do this? getValue() doesn't seem to let me use the methods associated with each ImageButton. 
I have a map of <CheckBox, ImageButton>.
I want to be able to iterate over this map and change the image of each ImageButton. Is there any way I can do this? getValue() doesn't seem to let me use the methods associated with each ImageButton. 
 
    
     
    
    // support you define your hash map like this
HashMap<CheckBox,ImageButton> hs = new HashMap<CheckBox,ImageButton>();
// then
for(Map.Entry<CheckBox, ImageButton> e : hs.entrySet())
{
    ImageButton imgBtn = e.getValue();
    // do whatever you like to imgBtn
}
 
    
    A HashMap? Use HashMap.values() to get a Collection of the saved Values. http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html#values()
 
    
    Taken from this answer
You have to cast the result of getValue to an ImageButton to use its functions.
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
    Map.Entry pair = (Map.Entry)it.next();
    ((ImageButton)pair.getValue()).setImageBitmap(bitmap);
}
 
    
    