Create Constructor in adapter class :
public DataAdapter(List<Pojo> dataList, OnItemClickListener listener) {
this.dataList = dataList;
this.listener = listener;
}
Create OnBindViewHolder()
method and get position :
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
final Pojo movie = dataList.get(position);
holder.Showid.setText(movie.getCatagory_id());
holder.fname.setText(movie.getCatagory_name());
holder.thumbNail.setImageUrl(movie.getCatagory_thumbnailUrl(), imageLoader);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
listener.onItemClick(movie.getSubCatagoryArrayList());
}
});
}
In MainActivity.class
create on Interface :
public interface OnItemClickListener {
void onItemClick(ArrayList<Pojo2> item);
}
0
solved using onClick to open details depending on the position of Recycler view