这里我有一个关于我的代码的简单问题,我如何从基本适配器获取项目 ID
在这里,我从活动中调用了适配器:
adapter = new sampleadapter(screen.this,imageIds);
listview.setAdapter(adapter);
适配器类:
public class sampleadapter extends BaseAdapter {
public sampleadapter(screen ListViewActivity,int[] imageIds) {
// TODO Auto-generated constructor stub
}
public int getCount() {
return imageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
vi=convertView;
vi = LayoutInflater.from(parent.getContext()).inflate(R.layout.explorescreen, null);
Holder.images=(ImageView) vi.findViewById(R.id.image);
Holder.images.setImageResource(imageIds[position]);
vi.setTag(ViewHolder);
Holder = (ViewHolder) vi.getTag();
return vi;
}
};
这里 :
我需要将值传递imageIds[position]
给我的活动我该怎么做?
任何人都可以帮助我,@提前谢谢!!!!