I have prblem with getting image view: Initially contains the absolute path of the file in the database and is displayed as text, but now I want to show a picture. How to do this?
public View getView(int position, View convertView, ViewGroup parent) {
// get view reference
View view = convertView;
// if null
if(view == null) {
// inflate new layout
view = mInflater.inflate(R.layout.acivity_layout_list_item, null);
// create a holder
ViewHolder holder = new ViewHolder();
// find controls
holder.txtImage = (TextView)view.findViewById(R.id.txtImage);
... other holder.txtparameters
// set data structure to view
view.setTag(holder);
}
// get selected user info
UserInfo userInfo = mListUserInfo.get(position);
// if not null
if(userInfo != null) {
// query data structure
ViewHolder holder = (ViewHolder)view.getTag();
// set data to display
holder.txtImage.setText(userInfo.getmImage());
...
}
// return view
return view;
}
static class ViewHolder {
private TextView txtImage;
...
}
0 comments:
Post a Comment