//回调接口
public interface BottomCallBackInterface { public interface OnBottomClickListener { void onBottomClick(View v, int position); } }
//适配器中引用该方法
private OnBottomClickListener mListener; public WaitTakingAdapter(Context context, List<OrderInfo> dataList, OnBottomClickListener listener) { if(context == null){ return; } this.mContext = context; this.dataList = dataList; mListener = listener; } //响应回调事件 holder.layoutDetail.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if(mListener != null){ mListener.onBottomClick(arg0, position); } } });
在Activity中实现该接口
implements BottomCallBackInterface
mAdapter = new WaitTakingAdapter(mContext, sortList, new OnBottomClickListener() { @Override public void onBottomClick(View v, int position) { OrderInfo info = sortList.get(position); if(v.getId() == R.id.item_order_wait_layout_check){ } } }
本文出自 “爬过山见过海” 博客,请务必保留此出处http://670176656.blog.51cto.com/4500575/1843002
原文地址:http://670176656.blog.51cto.com/4500575/1843002