I am trying to pass position of recyclerview to another activity where I am calliing retrofit Interface. Can I pass position of Recyclerview item so I can load different post from api
@Override
public void onBindViewHolder(TagAdapter.Tag_ViewHolder holder, final int position) {
holder.tagName.setText(Tags.get(position));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (position < 8){
int pos = (int) getItemId(position) + 1;
Intent intent = new Intent (view.getContext(), Tag1Post.class);
intent.putExtra("pos", pos);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
My EndPoint is
@GET("/tag/{id}/")
Call<Tag> test(@Path("id") int id);
I want to replace id by RecyclerView position.