Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PhotosAdapter extends RecyclerView.Adapter<PhotosAdapter.PhotosViewHolder> {
- private Context context;
- private List<Photo> items;
- public PhotosAdapter(Context context, List<Photo> items) {
- this.context = context;
- this.items = items;
- }
- //other code here
- public void addAll(List<Photo> newItems) {
- int beforeSize = items.size()-1;
- items.addAll(newItems);
- notifyItemRangeInserted(beforeSize, newItems.size());
- }
- }
- new PhotosAdapter(getContext(), new ArrayList<Photo>());
- new PhotosAdapter(getContext(), new LinkedList<Photo>());
- adapter.addAll(myPhotos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement