| | |
| | | public class TestTitleAdapter extends RecyclerView.Adapter<TestTitleAdapter.TestItem> { |
| | | |
| | | private OnClickListener mOnClickListener; |
| | | private List<String> mList; |
| | | private final List<String> mList; |
| | | |
| | | public TestTitleAdapter(List<String> list) { |
| | | this.mList = list; |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (mOnClickListener != null) { |
| | | mOnClickListener.OnClick((int) holder.textView.getTag()); |
| | | mOnClickListener.OnClick((int) holder.textView.getTag(), holder.textView.getText().toString()); |
| | | } |
| | | } |
| | | }); |
| | |
| | | public int getItemCount() { |
| | | return mList.size(); |
| | | } |
| | | |
| | | |
| | | static class TestItem extends RecyclerView.ViewHolder { |
| | | |
| | |
| | | } |
| | | |
| | | public interface OnClickListener { |
| | | void OnClick(int position); |
| | | void OnClick(int position,String title); |
| | | } |
| | | |
| | | |
| | | } |