How can i update position on scroll. right now the position gets updated every time i click on item. i want to update the position every time i scroll. What i wanna do is have a text view which will get updated when scrolling through the items.
recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(this, recyclerView, new GalleryAdapter.ClickListener()
{
@Override
public void onClick(View view, int position) {
Intent intent = new Intent(mainActivityCarasoul.this, PDFViewerActivity.class);
intent.putExtra(PDFViewerActivity.TAG, books.get(position));
intent.putExtra("from", "mainActivityCarasoul");
startActivity(intent);
}
@Override
public void onLongClick(View view, int position) {
}
}));
recyclerView.addOnScrollListener(new CenterScrollListener());
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
// title.setText(books.get(position).getName());
}
});