这是我的问题:
我为我的ListView创建了一个自定义适配器,我从List中获取信息,我给了该适配器,以便让他实现我的ListView.他做的一切都很正确.现在我想实现一个OnItemClickListener并从中获取数据.但是在那个列表中我有4个TextViews ......
我该如何检索数据?
我已经知道如何获得id和位置,因为我在Toast中显示它们.
非常感谢你的帮助 !
这是自定义适配器:
public class NextRdvAdapter extends ArrayAdapter<NextRdv> {
private List<NextRdv> listNextRdv = new ArrayList<NextRdv>();
private Context context;
public NextRdvAdapter(List<NextRdv> nextRdvList, Context ctx) {
super(ctx, R.layout.list_next_rdv, nextRdvList);
this.listNextRdv = nextRdvList;
this.context = ctx;
}
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) { // This a new view we inflate the new layout
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_next_rdv, parent, false);
} // Now we …Run Code Online (Sandbox Code Playgroud)