Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class PhotosAdapter extends RecyclerView.Adapter<PhotosAdapter.PhotosViewHolder> {
  2.  
  3. private Context context;
  4.  
  5. private List<Photo> items;
  6.  
  7. public PhotosAdapter(Context context, List<Photo> items) {
  8. this.context = context;
  9. this.items = items;
  10. }
  11.  
  12. //other code here
  13.  
  14. public void addAll(List<Photo> newItems) {
  15. int beforeSize = items.size()-1;
  16. items.addAll(newItems);
  17. notifyItemRangeInserted(beforeSize, newItems.size());
  18. }
  19.  
  20. }
  21.  
  22. new PhotosAdapter(getContext(), new ArrayList<Photo>());
  23.  
  24. new PhotosAdapter(getContext(), new LinkedList<Photo>());
  25.  
  26. adapter.addAll(myPhotos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement