Привет, я создаю собственный просмотр списка с texview, imageview, и я получаю доступ к данным из базы данных sqlite, где я сохраняю имя каждого изображения и помещаю изображения в папку assests, когда пытаюсь получить к нему доступ, используя holder.mimage.setImageResource(list.get (положение) .getImage ());это дает ошибку, как я могу получить к нему доступ, любое предложение будет очень полезно
public class InteractiveArrayAdapter extends ArrayAdapter<PosHolder> {
String tag = "Events";
private final List<PosHolder> list;
private final Activity context;
int li,jh;
public InteractiveArrayAdapter(Activity context, List<PosHolder> list) {
super(context, R.layout.row, list);
this.context = context;
this.list = list;
}
static class ViewHolder {
protected TextView text;
protected CheckBox checkbox,checkbox1;
protected RadioGroup mgroup;
protected RadioButton mbutton;
protected ImageView mimage;
}
public View getView( final int position, View convertView, ViewGroup parent) {
//Log.d(tag," 3");
View view =null;
if (convertView == null) {
//System.out.println("ok");
LayoutInflater inflator = context.getLayoutInflater();
view = inflator.inflate(R.layout.row, null);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) view.findViewById(R.id.textView1);
viewHolder.mimage = (ImageView) view.findViewById(R.id.imageView1);
view.setTag(viewHolder);
viewHolder.mimage.setTag(list.get(position));
} else {
view = convertView;
((ViewHolder) view.getTag()).mimage.setTag(list.get(position));
}
ViewHolder holder = (ViewHolder) view.getTag();
view.getTag()).mgroup.getTag();
holder.text.setText(list.get(position).getName());
holder.mimage.setImageResource(list.get(position).getImage());//This line is showing the error
return view;
}
public class PosHolder {
private String name;
private String smallimage;
public PosHolder(String name, String smallimage) {
// TODO Auto-generated constructor stub
this.name=name;
this.smallimage=smallimage;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return smallimage;
}
public void setImage(String phone) {
this.smallimage = phone;
}}