Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add more item in a list view without refreshing the previous item

Tags:

android

I have a listview in which i am adding some data after fixed interval.but I don't want to set the adapter again as it will refresh the complete list.Is there any method to add item without refreshing the complete list.

Thanks in advance.

like image 834
swati Avatar asked Jul 24 '12 07:07

swati


Video Answer


1 Answers

You probably want to use the following (in RecycleView not ListView):

notifyItemInserted(0);//NOT notifyDataChanged()
recyclerViewSource.scrollToPosition(0);
//Scroll up, to use this you'll need an instance of the adapter's RecycleView 
like image 71
ben Avatar answered Oct 10 '22 03:10

ben