我怎么能传递值从基本适配器活动 [英] How could i pass the value from base adapter to activity
本文介绍了我怎么能传递值从基本适配器活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个应用程序的工作,我需要从基本适配器类的值传递给活动
I am working in one app where i need to pass the value from base adapter class to activity
下面是片段code:
public View getView(int position, View convertView, ViewGroup parent) {
vi=convertView;
if(convertView==null){
vi = LayoutInflater.from(parent.getContext()).inflate(R.layout.screen, null);
position_pin = position;
Holder.images=(ImageView) vi.findViewById(R.id.image);
Holder.textview=(TextView) vi.findViewById(R.id.name);
Holder.images.setImageResource(imageIds[position]);
Holder.text.setText(name);//here name is String
vi.setTag(Holder);
}
return vi;
}
下面我得到的图片ID位置:
Here i am getting the image id position:
Holder.images.setImageResource(imageIds[position]);
我怎么能传递imageIds位置,活动谢谢!
推荐答案
U可以使用下面code-UR活性内部
U can use below code inside ur activity
for(int i=0;i<list.getCount();i++)
{
//here u can add i values to an array for storing positions or do anything else u want
}
这篇关于我怎么能传递值从基本适配器活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文