I am trying to insert an item in recycler view at first position i.e, 0 index as below
try {
commentList.add(new Comment(
Preferences.getProfileImageUrl(),
"",
Preferences.getUserName(DONApplication.getInstance()),
String.valueOf(Preferences.getUserId(DONApplication.getInstance())),
response.getString("comment_id"),
commentText
));
commentAdapter.notifyItemInserted(commentList.size() - 1);
} catch (Exception e) {
e.printStackTrace();
}
but its not showing at all but when I close the window and open it again it gets visible. I don't know why it is happening. Can someone help me?