I used listview to show some data.I wrote setonScrollListener in my listview
mTransactions.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (mTransactionAdapter.getCount() > firstVisibleItem) {
if (mTransactionAdapter.getItem(firstVisibleItem) != null) {
String date = DateUtils.formatToDayMonthInWordAndYear(mTransactionAdapter.getItem(firstVisibleItem).getDate());
if (!date.equals(mTransactionHeaderWrapper.getTextView().getText().toString())) {
mTransactionHeader.setText(date);
}
}
}
}
});
Now I'm using recyclerView and i don't know how i can use this code in RecyclerView.if onyone knows how i can rewrite my code please help me.thanks