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
5
votes
3 answers

How to use RecyclerView, Trying to follow developer.android.com suggestion but get error

I'm trying to use RecyclerView to show my dataset, trying to follow this website https://developer.android.com/training/material/lists-cards.html Problem is that there is some part wrong and can't find out how to fix it, I did exactly how that site…
5
votes
1 answer

Multiple RecyclerView items in one CardView

I'm trying to create multiple RecyclerView items in each CardView item as this app does: I had created a cardview_item.xml that contains the dataset item (the match in this example) and a cardview_title.xml that contains the title of the card (the…
5
votes
1 answer

TextView scrolling is resetting when I update a different TextView from the same ListView row

I have a listview and for a specific item I'm refreshing the remaining time every second. It works fine, but I'm having a small bug. Whenever I call duration.setText(newRemainingValue); to update the value, another textView from the same row is…
user1026605
  • 1,633
  • 4
  • 22
  • 58
5
votes
1 answer

Recyclerview in a fragment doesnt show anything

i have a fragment, where i want to include a recyclerview. But unfortunately it doesnt show anything, it seems that the viewholder methods doesnt get started. (sorry for my bad english). Here is my code for the fragment: public class Quran_Fragment…
5
votes
1 answer

Android Google maps fragment in RecyclerView.ViewHolder

How can I get to GoogleMap from RecyclerView.ViewHolder I have: public class MapRowHolder extends RecyclerView.ViewHolder { public MapRowHolder(View view) { super(view); } } xml:
5
votes
2 answers

Google Map Lite in CardView

I have been trying to get a very basic app going to play around with Material Design. I am trying to create a Listview (using the new RecyclerView) in with every item is a Card witch has a Google Maps Lite in it. I have basicly been following this…
4
votes
2 answers

What does binding.root indicates for?

Following is my code snippet. class DashBoardHolder(val binding: ActivityDashBoardBinding) : RecyclerView.ViewHolder(binding.root) { internal var tvName: TextView = itemView.findViewById(R.id.textViewGrandrukName)
4
votes
1 answer

How to fill title and grid layouts with the next page "10 items"

In my app I have four layouts, "Card List" , "Card Magazine" , "Title" and "Grid", I make option menu to allow the users to change it from the Option Menu "change the layout", the problem happening here is when running the app first time with…
4
votes
2 answers

Coroutine inside ViewHolder? [Kotlin]

I'm wondering if it's possible launch a Coroutine inside ViewHolder, I mean, Imagine that you press an item inside OnBindViewHolder and you need to call an API to get a response... I don't know if I could use Coroutines inside it! Thank you so…
Antonio Labra
  • 1,694
  • 2
  • 12
  • 21
4
votes
0 answers

ConcatAdapter how to change scroll position of inner RecyclerView that is located in an Adapter from another Adapter?

In the image section with Favorites and the horizontal RecyclerView is one adapter, adapterFavoriteProperties, while the row with chart is another adapter, adapterChart, of the main RecyclerView. Main RecyclerView is composed of rows that coming…
4
votes
3 answers

RecyclerView Perform Item Click

I have a RecyclerView that contains expandable items. clicking on an item expands it. The problem is it also expand some other cards, unexpectedly. I checked everything and I couldn't find why is this happening, but I did manage to find out that the…
4
votes
2 answers

Nested RecyclerView creates all ViewHolders at once

I have a rather complicated List with nested RecyclerViews. I get it that nested RecyclerViews aren't the best solution, but in my case it is one of few solutions that create structured code and meet the requirements. I have attached an image of the…
4
votes
1 answer

ClassCastException custom ViewHolder cannot be cast to another Viewholder

my project should create multiple views based on user input (user send text, take a photo or record a video) similar to WhatsApp chat activity, almost same structure. The adapter should be able to identify which type of view the item is, by using…
4
votes
4 answers

Switch between RecyclerView layouts when click on AlertDialog item list

I have three different layouts cardsListLayout , titleLayout , cardMagazineLayoutand there may be more in the future, which used as a views on onCreateViewHolder method. I want to switch between views in onCreateViewHolder method so when user …
4
votes
3 answers

Remove a item from a RecyclerView (ViewHolder has the onClick but adapter has the dataset)

I want to delete items from a recyclerview when pressing a view which is in the items. The situation: Having a list made using a RecyclerView with a dataset and a ViewHolder which has a onClick on a view for deleting the item from the list, I need…
NullPointerException
  • 36,107
  • 79
  • 222
  • 382