i want to add to each raw a specific image that belong to each raw content in android listview... example: if i am making a list view the countries and i want each country to have its flag ... (example : (imageUSA-FLAG) USA (imageUK-FLAG) UK (imageFRANCE-FLAG) FRANCE ...
            Asked
            
        
        
            Active
            
        
            Viewed 1,828 times
        
    2 Answers
1
            
            
        You could do it for exampe like that:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
   ImageView myImageView = new ImageView();  
   switch(position) {
      case 0: myImageView.setImageResource(R.drawable.imageUSA-FLAG);
      break;
      case 1: myImageView.setImageResource(R.drawable.imageUK-FLAG);
      break;
      case 2: myImageView.setImageResource(R.drawable.imageFRANCE-FLAG);
      break;
    }
    return myImageView;
}
0
            
            
        If you actually searched before you posted then you would have found this entry
 
    
    
        Community
        
- 1
- 1
 
    
    
        peter_budo
        
- 1,748
- 4
- 26
- 48
