Android - Reverse listview as message display
I think you should look into using TranscriptMode and StackFromBottom with your listview:
android:stackFromBottom="true"
android:transcriptMode="normal"
By setting the transcript mode to normal it will scroll to the bottom only if the last item was already in view. That way your users can view the previous list view items without interruption when you call notifydatasetchanged.
do like this:
Collections.reverse(YourList); // ADD THIS LINE TO REVERSE ORDER!
YourList.notifyDataSetChanged;
For Kotlin is more easy just
myList.reverse()
I fixed this by using the same code as you included but I update the index variable by the number of items I add to the adapter before restoring the position. Seems to do the trick.