6

I've been reading about RecyclerView and it's advantages over ListView And I got the difference between them.

What I don't get is when to use ListView and when to use RecyclerView. And is the RecyclerView meant to replace ListView? Do I have to replace all my ListViews with RecyclerViews?

Abdallah Alaraby
  • 2,222
  • 2
  • 18
  • 30
  • 2
    "when to use ListView and when to use RecyclerView" -- if you need some of the advanced capabilities of `RecyclerView` (e.g., animated effects as you add/remove items), use `RecyclerView`. "Do I have to replace all my ListViews with RecyclerViews?" -- no. – CommonsWare Feb 09 '15 at 15:23
  • check the thread: [Should we use RecyclerView to replace ListView?](http://stackoverflow.com/questions/28392554/should-we-use-recyclerview-to-replace-listview) – Xcihnegn Feb 09 '15 at 15:49

3 Answers3

6

is the RecyclerView meant to replace ListView?

Yes.

Do I have to replace all my ListViews with RecyclerViews?

No.

What I don't get is when to use ListView and when to use RecyclerView.

My recommendation is to use only RecyclerView for lists going forward. It is meant as a replacement for ListView, and it is a fantastic one at that. I would expect RecyclerView to continue to receive updates, but ListView will likely remain more or less as it is right now.

ListView isn't going anywhere because there are far too many applications that use it. Google can't just remove it because that would prevent most existing apps from compiling with the latest SDK. Deprecating it also isn't ideal because converting a ListView to a RecyclerView is a non-trivial amount of work and there isn't anything particularly broken with ListView.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • Hi Tanis, could you please check my question [Should we use RecyclerView to replace ListView?](http://stackoverflow.com/questions/28392554/should-we-use-recyclerview-to-replace-listview) and give comprehensive answer – Xcihnegn Feb 09 '15 at 15:52
1

RecyclerView is the successor of ListView - so you should use it for all new code - but there is no immanent need to replace all ListViews now

ligi
  • 39,001
  • 44
  • 144
  • 244
0

For me, ListView is more used in functional scenario, because it has built-in setOnItemClickListener() and setMultiChoiceModeListener() (multiselection mode), which are lack of in RecyclerView. On the other hand, RecyclerView is more used in display scenario, because it supports drag and drop funcitonality (built-in animation).

Sam Chen
  • 7,597
  • 2
  • 40
  • 73