Tag: recyclerview

Partial update of RecyclerView.ViewHolder

I’m trying to change the field with time in my RecyclerView. Each individual ViewHolder contains a CardView and a few more views inside. The only view I want to animate is the one with time. As you can see, there is no animation: adapter.notifyDataSetChanged(); Updating items one by one doesn’t help because then the whole […]

android notifyItemRangeInserted disable autoscroll

I’m using RecyclerView as the base for my data list. i’ve implemented custom RecyclerView.Adapter which is based on ArraList. on fetching data from the internet the code that i’m running is: public void addItems(List<Item> items){ final int size = data.size(); data.addAll(items); notifyItemRangeInserted(size, items.size()); } Problem is that for after running this code i’m getting an […]

How can I identify that RecyclerView's last item is visible on screen?

I have one RecyclerView, I added list of data into the RecyclerView. I want to add new data in, when last RecyclerView item gets visible on screen. After that I want to make a web service call and update the RecyclerView data. How can I achieve this? Any suggestions?

Recycle view – java.lang.NullPointerException

I am getting following exception while i’m try to display recycle view: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()’ on a null object reference at android.support.v7.widget.RecyclerView.computeVerticalScrollRange(RecyclerView.java:1216) at android.view.View.onDrawScrollBars(View.java:13900) at android.view.View.draw(View.java:16275) at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:2440) at android.view.View.updateDisplayListIfDirty(View.java:15192) at android.view.View.getDisplayList(View.java:15215) at android.view.View.draw(View.java:15990) at android.view.ViewGroup.drawChild(ViewGroup.java:3708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502) at android.view.View.draw(View.java:16272) at android.view.View.updateDisplayListIfDirty(View.java:15192) at android.view.View.getDisplayList(View.java:15215) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3692) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3671) at android.view.View.updateDisplayListIfDirty(View.java:15152) […]

Getting position of View in onCreateViewHolder

I am using a RecyclerView with a single row layout with an ImageView and a TextView. I want to implement a OnClickListener for the View and not for seperate ViewHolder objects. How can i get the position of the view in the Adapter? Right now i’m deleting comments on click, but i cannot select the […]

How to get the Scrollposition in the Recyclerview/Layoutmanager?

How to get the scrollposition in Recyclerview or the Layoutmanager? I can measure the scrollposition by adding an OnScrollListener, but when the Orientation changes scrollDy is 0. mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int scrollDy = 0; @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { […]

RecyclerView.onBindViewHolder called only once

After many hours of researching I am finally consulting official help. I have a RecyclerView.Adapter and RecyclerView.ViewHolders that worked perfectly. But for some reasons I do not understand, RecyclerView.Adapter.onBindViewHolder is not called properly. private class AttendeeAdapter extends RecyclerView.Adapter<AttendeeHolder> { /*FIELDS*/ private List<Attendee> mAttendeeList; /*CONSTRUCTORS*/ public AttendeeAdapter(List<Attendee> attendees) { mAttendeeList = attendees; //Log.i(TAG, “AttendeeAdapter size: ” […]

How do I create a circular (endless) RecyclerView?

I am trying to make my RecyclerView loop back to the start of my list. I have searched all over the internet and have managed to detect when I have reached the end of my list, however I am unsure where to proceed from here. This is what I am currently using to detect the […]

How do I add a horizontal RecyclerView inside a list item

The task of implementation is I need to create an infinite scrollable list which will scroll both horizontally and vertically. For this what I’m trying to do is that I have integrated a horizontal RecyclerView inside a vertical ListView item. Is this the right way to go about? I have tried other solutions but the […]

RecyclerView – offscreen items skipping first layout pass

I am having trouble with one of my adapters. I have a selection of images which I display in a grid like the following: This works well when I have a single screen worth of items and they all show up fine. The problem appears when there are more items to scroll down to. Initially […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.