I want my RecyclerView to scroll to the bottom when a new item is added to the list. Below is my code:
RecyclerView.LayoutManager layoutManager = new LinearL
Maybe this will help someone
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
if (pingAdapter != null) {
Ping ping = dataSnapshot.getValue(Ping.class);
pingAdapter.pings.add(ping);
recyclerView.smoothScrollToPosition(pingAdapter.getItemCount());
pingAdapter.notifyDataSetChanged();
}
}
recyclerView.smoothScrollToPosition(pingAdapter.pings.size());
is even faster