mardi 22 mars 2016

android recyleview cardadapter cant use conditional statement

I am using a recylceview and would like to put a if statement in the cardadapter activity, but it doesn't seem to work. I would like the cardadapter to get a image and display and if their is no image use a drawable image;

The problem is not specifically with the images but the if statements them self as i have tried to use them for several things like if text == null do this.

@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
    ListItem list =  items.get(position);
    holder.textViewName.setText(list.getName());
    holder.textViewUrl.setText(list.getData());

    if(list.getImage() == null){
         //choose picture from drawable        
    }
     else{
         holder.imageView.setImageBitmap(list.getImage());
}
}

Aucun commentaire:

Enregistrer un commentaire