Questions tagged [android-viewholder]

A ViewHolder object stores each of the component views inside the tag field of the Layout, so you can immediately access them without the need to look them up repeatedly. The ViewHolder pattern is often used in Android applications to improve performances of view access.

A ViewHolder object stores each of the component views inside the tag field of the Layout, so you can immediately access them without the need to look them up repeatedly. The ViewHolder pattern is often used in Android applications to improve performances of view access.

For an example, check the official Android documentation on the ViewHolder pattern.

1064 questions
1
vote
0 answers

RecyclerViewPool with same viewtype but different view bounds

I'm sharing a RecycledViewPool between different RecyclerViews with same view type. Although the view type has different view bounds. For eg: In RecyclerView1 the width of a single item is 100dp where as in RecyclerView2 the width of a single items…
1
vote
0 answers

Inconsistency detected. Invalid view holder adapter positionk{position=5 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent}

Well, i had gone through every portal to know the issue but hadn't worked, Actually it crashed randomly. Exception is as follows, Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter…
1
vote
2 answers

RecyclerView Viewholder - How to set gravity after dynamically inflating size of layout?

I've created a RecyclerView adapter that sizes the viewholder based on 33% of the screen size. @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater =…
DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
1
vote
1 answer

RecyclerView: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()'

First of all, I am completefy noob to android development and I am making this project for my college where I display items in a Recycler view, each Item has a delete button and it updates the product quantity, reloads the recycer view. The recycler…
1
vote
1 answer

Recyclerview does not display on the screen in kotlin

So I tried to create multi views recyclerview in kotlin, but sadly it did not work.The recyclerview does not display on the screen. It worth to mention that I tried to set the orientation as vertical in my layout files, also added all the…
1
vote
3 answers

How to create a layout with rounded corners on only the top or bottom half?

I'm trying to add row items into a RecyclerView that looks like this: The view layout has 2 versions; one with an image on the top half and one that only contains text. A few things make this a tricky layout to create; The image is only rounded on…
szaske
  • 1,887
  • 22
  • 32
1
vote
2 answers

ConstraintLayout barrier doesn't work correct for all view holders of RecylcerView

I have three TextViews (Rating, VotesRating and Votes) in one line but only one of them can be visible at the same time. That's why I added a Barrier with ids of those TextViews movie_rating,movie_votes,movie_rating_votes. And then I use that…
1
vote
1 answer

How to get view binding to work with XML layout heights in RecyclerView.ViewHolder like they did with Kotlin Synthetics?

While trying to convert an application from the defunct Kotlin synthetics to the newer/supported view binding method, I ran into this issue where layouts are inflated but layout_height is being ignored in the inflated layouts. The result is a…
1
vote
3 answers

how to android recyclerview change different holder view background

The picture is when I clicked 1. I want to change the background of other items when clicking the recyclerview item But looking at my code and thinking, I can't change other holder items when I click the itemview I did a Google search, but I…
Duseop
  • 137
  • 2
  • 11
1
vote
0 answers

Show Date Tag in Recyclercview chat and filter data w.r.t date like in whatsapp

I have a recycler view with multiview types (For Incoming and Outgoing) messages and a static list which I am passing to the adapter to test my UI. My goal is to sort view holders' messages w.r.t data like we have in whatsapp. I have a separate…
1
vote
1 answer

Changing Item in onClick of RecyclerView

I have a list of contacts that is shown in recyclerview. After clicking on an item its view changes in the way I want to and if I click on another item the previous selected one returns back to its original state so, so far everything is good.…
1
vote
1 answer

RecyclerView doesn't display data but onBindViewHolder never called

I'm using recyclerView to display my data but anything is displaying. The onBindViewHolder is never called and the onCreateViewHolder also. I initialize the adapter in the viewModel with the data which I got from room but anything is displaying. The…
1
vote
2 answers

Cannot resolve symbol 'ViewHolder' Java Android studio

I have tried other examples online and in stack overflow but cannot solve this issue I was following a tut made years ago which uses ViewHolder but it gives me error "Cannot resolve symbol 'ViewHolder'" this is for a part of my notepad tool inside…
Brett Hudson
  • 51
  • 1
  • 7
1
vote
1 answer

How to use different layouts for incoming & outgoing chat messages

I have a design for messages. 2 xml files are responsible for the design: recyclerview_item_incoming.xml recyclerview_item_outgoing.xml It looks like this: Messages are stored inside the RecyclerView. RecyclerView is connected to SQLite via…
1
vote
1 answer

ViewHolder with onClicklistener Issue with UninitializedPropertyAccessException

I'm a beginner so please bare with me. I have a viewholder that has an onclicklistener. The aim of the click is to send a Url string into another fragment using Jetpack Navigation (hopefully i did it right) the Url is being created within the…