android-recyclerview

RecyclerView scrolls to bottom when data is loaded

ぃ、小莉子 提交于 2020-12-25 01:51:06
问题 I have some weird issue with RecyclerView since I changed my app to load the data from Room database. I have a screen (a Fragment ) which displays a Profile for a user. Basically it's a GridLayout with the first item (row) displaying some info about the user and then for each row I'm displaying three images. The code for the RecyclerView is : private void initializeRecyclerView() { if (listAdapter == null) { listAdapter = new PhotosListAdapter(getActivity(), userProfileAccountId, false); }

RecyclerView scrolls to bottom when data is loaded

痞子三分冷 提交于 2020-12-25 01:46:44
问题 I have some weird issue with RecyclerView since I changed my app to load the data from Room database. I have a screen (a Fragment ) which displays a Profile for a user. Basically it's a GridLayout with the first item (row) displaying some info about the user and then for each row I'm displaying three images. The code for the RecyclerView is : private void initializeRecyclerView() { if (listAdapter == null) { listAdapter = new PhotosListAdapter(getActivity(), userProfileAccountId, false); }

clicklistener not working in recyclerview

笑着哭i 提交于 2020-12-15 06:07:48
问题 Im following this link answer--> https://stackoverflow.com/a/32323801/12553303 ...on click of item im getting an error of invalid product id...but how do i get id from adapter to activity??????? i have used interface for click listener... need help in here --> RetrofitClient.instance.deletecart(token, dataList?.get(position)?.product_id.toString()) on debuuging this line following is my code :-- class CartAdapter(private val context: Context, private val dataList: MutableList<DataCart?>?) :

How to get item from Recycler View?

生来就可爱ヽ(ⅴ<●) 提交于 2020-12-13 04:53:27
问题 I created list using Recycler View. Now I want to get item after click. I heard about getAdapterPosition but I dont know how to use it. I try something like this but honestly dont know how to get it. My Fragment class code: public class FragmentOne extends Fragment { private static RecyclerView.Adapter adapter; private RecyclerView.LayoutManager layoutManager; private static RecyclerView recyclerView; private List<MovieDb> data; private MovieDb movieDb; static View.OnClickListener

Android Kotlin New intent on click event from recycler view

為{幸葍}努か 提交于 2020-12-13 03:13:36
问题 I've just started learning android development with Kotlin. I have a recycler view that lists items. I'm trying to create onClick event for the item and then start a new intent and pass along the item id. I'm getting an error when trying to instantiate the Intent "None of the following functions can be called with the arguments supplied". I think it's because I cannot access the context of the view? override fun onBindViewHolder(holder: ViewHolder, position: Int) { holder.id = events[position

Android Kotlin New intent on click event from recycler view

回眸只為那壹抹淺笑 提交于 2020-12-13 03:11:33
问题 I've just started learning android development with Kotlin. I have a recycler view that lists items. I'm trying to create onClick event for the item and then start a new intent and pass along the item id. I'm getting an error when trying to instantiate the Intent "None of the following functions can be called with the arguments supplied". I think it's because I cannot access the context of the view? override fun onBindViewHolder(holder: ViewHolder, position: Int) { holder.id = events[position

Vertical ViewPager2 with RecyclerView Scrolling Issue

痞子三分冷 提交于 2020-12-10 07:37:56
问题 I'm using a ViewPager2 with two fragments in a vertical orientation. When the user swipes down to the second fragment, there is a RecyclerView that scrolls content in the same vertical direction. The issue is that when I scroll the contents of the RecyclerView, sometimes the ViewPager2 catches the scroll events and sometimes the RecyclerView catches the scroll events. I would like it so that when the user is scrolling to the top of the RecyclerView, the ViewPager only swipes back up to the

Using DiffUtil, How to prevent blocking the main thread when updating the recyclerView contained in a NestedScrollView?

久未见 提交于 2020-12-07 10:56:01
问题 I'm trying to udate my recyclerView in background Thread without any succes. Updating the recyclerView still block the main thread. Here my adapter: public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> { private List<PostItems> postList; private Context context; private Queue<List<PostItems>> pendingUpdates = new ArrayDeque<>(); PostAdapter(List<PostItems> postList, Context context) { this.postList = postList; this.context = context; } @NonNull @Override public

Using DiffUtil, How to prevent blocking the main thread when updating the recyclerView contained in a NestedScrollView?

穿精又带淫゛_ 提交于 2020-12-07 10:55:07
问题 I'm trying to udate my recyclerView in background Thread without any succes. Updating the recyclerView still block the main thread. Here my adapter: public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> { private List<PostItems> postList; private Context context; private Queue<List<PostItems>> pendingUpdates = new ArrayDeque<>(); PostAdapter(List<PostItems> postList, Context context) { this.postList = postList; this.context = context; } @NonNull @Override public

IndexOutOfBoundException with RecyclerView

谁都会走 提交于 2020-12-06 23:56:32
问题 I am experiencing a problem with my application. I am getting a java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder and not only on Samsung device but also on LG because I have read somewhere that this exception only happens on Samsung device. My solution was to make my own LinerLayoutManager and to catch the exception in onLayoutChildren() method. After implementing this solution the exception doesn't occur very often like before but