Currently, I am exploring the option of displaying data from a database by swiping left to right and also allowing users add and remove dat
In term of ease of implementation (this is just my own opinion),
ViewPager
is good for displaying the list of data that is not required often add and remove since PagerAdapter
can't notify each specific item that it is removed or added it can only call notifyDataSetChanged()
which notify that all set of data has been changed. Therefore, it is hard to handle the animation when the item is added or removed.
While in RecyclerView
, RecyclerView.Adapter
has methods like notifyItemInserted(int position)
or notifyItemRemoved(int position)
to notify that specific the item is added or removed and, the animation when item is add or remove is already handle when you called those method.
Moreover, right now it is very easy for RecyclerView
to mimic the ViewPager
behavior by using SnapHelper
. There is PagerSnapHelper
, and the behavior of ViewPager
can be obtained with just a few lines of code. You can contact me if you want the code.