[android-developers] change the imageview dynamically in the listview
hi all,
I was defined a new adapter for my listview,
every rows content in the listview will include three information,
that's image(imageview), title(text) and time information(text),
then the three information was retrieve from server at the program
beginning,
and then use adapter to fill ervery rows.
now I have a problem about image information, I don't know how to fill
the
image in the every rows of listview.
I will show my getView function of adapter code,
plz give me some suggestion, thanks!
=============getView()============================
public View getView(int position,View convertView,ViewGroup par)
{
ViewHolder holder_title,holder_duration,holder_thumbnail;
holder_title = new ViewHolder();
holder_time=new ViewHolder();
holder_image=new ViewHolder();
if(convertView == null)
{
convertView = mInflater.inflate(R.layout.rows_content, null);
holder_title.text = (TextView) convertView.findViewById
(R.id.title);
holder_time.text = (TextView) convertView.findViewById
(R.id.time);
holder_image.icon=(ImageView) convertView.findViewById
(R.id.image);
convertView.setTag(holder_title);
convertView.setTag(holder_time);
convertView.setTag(holder_image);
}
else
{
holder_title = (ViewHolder) convertView.getTag();
holder_time = (ViewHolder) convertView.getTag();
holder_image=(ViewHolder) convertView.getTag();
}
//import the information
holder_title.text.setText(entry_title.get(position)); //ok
holder_time.text.setText(time_duration.get(position)); //ok
*********the image I don't know how to do*********************
return convertView;
}
/* class ViewHolder */
private class ViewHolder
{
TextView text;
ImageView icon;
}
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home