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
2
votes
1 answer

RecyclerView Adding/re-adding Items

I'm assuming I am just not understanding the RecyclerView properly, however I am having a problem with adding an item after it's been deleted. My view consists of a card layout with some text and two image views. The two image views are stacked, and…
2
votes
1 answer

Android - how to add view to LinearLayout with RecylcerView.ViewHolder

I have a list of items. Each row has a TextView title and a LinearLayout containing child views. Eg: +++++++++++++++++++++++ Title 1 Child_1: price_1 price_2 price_3 price_4 price_5 Child_2: price_1 price_2 price_3 price_4 price_5 Child_3: price_1…
chrizonline
  • 4,779
  • 17
  • 62
  • 102
2
votes
1 answer

Android RecyclerView OnClickListener not reacting

Ok, so I'm using RecyclerView in my project and need to implement click listener for each list item and an icon in each of the items. What I tried was this solution: https://stackoverflow.com/a/24933117/722462 cause it looks pretty nice for me. But…
2
votes
4 answers

Buttons at the bottom of the list view in Android

I am working on Android application in which I want to fix the button at the bottom of the list, so if the list is refreshed and some more items add to the list so the button should be still at the last of last. I have used the following code but…
Usman Khan
  • 3,739
  • 6
  • 41
  • 89
2
votes
1 answer

ViewHolder cache pattern on ArrayAdapter has ripple effects

I have been following the ViewHolder pattern for a ListView, below the code. Actually it works well - but I have a problem. My items in the adapter have the following layout: ================================================================ | Item…
2
votes
1 answer

How to correctly use ViewHolder with custom view in list adapter

In my Android app, I have ListView which contains list of cars. Each car has list of (1 to 10) groups. In each list item I have horizontal list of groups. Im using FlowLayout for this horizontal list, adding "manually" views to this. Im wondering am…
devha
  • 3,307
  • 4
  • 28
  • 52
2
votes
2 answers

Adapter not getting updated when a value of a view is updated in listview

I'm using ListView to show list of some elements for which I need to count things. My list view looks like this The value "3" gets updated when I click on plus and minus button or reset button. This is how I achieve this in my…
2
votes
2 answers

button click inside listview item mixing up action on items

I have a listview with a button.When I click on the button I want the whole item to be set an alpha value and make the text of the button change. The base functionality (the item being set an alpha value and button text change) works but multiple…
2
votes
4 answers

How can i use Button OnClick in Custom ListView with View Holder

I need some help, i am using a viewholder to display from a dynamic arrayadapter. I have list view . Each row contains ; Title (Textview), sub title(TextView), Progress bar Download Button (Button). I want to show progress bar and hide Download…
delavega66
  • 855
  • 2
  • 23
  • 39
2
votes
0 answers

When I start one AnimationDrawable in the ListView item, some other AnimationDrawable starts

In each item of the ListView, there is an ImageView. I have set it's ImageDrawable with an AnimationDrawable. When the ResultReceiver receives a result, the AnimationDrawable starts or stop. Here is my code: public class PicassoListNearbyAdapter…
2
votes
1 answer

ViewHolder inflating layout on even and odd position

I need two layout to inflate on basis of even and odd position of listview items using ViewHolder. At even position I need a different layout and at Odd position another one having same elements but different layout. I implemented it, however, it…
addy123
  • 514
  • 2
  • 10
  • 28
2
votes
2 answers

Get data by position in custom adapter by onClickListener

look to my custom adapter that extends BaseAdapter: public class DrawerAdapter extends BaseAdapter{ static class ViewHolder{ TextView cat_Title; TextView cat_Count; } private Activity …
2
votes
1 answer

Problem with "ViewHolder" class in android

I have a problem with "ViewHolder" class. I use "ViewHolder" to improve my List display speech. I think the code is ok, but it throws exception when I am using "setText" with data from "Cursor". Here is my code: if(row==null){ …
Dennie
  • 2,621
  • 13
  • 42
  • 41
1
vote
1 answer

How can I iterate over items in onBindViewHolder without using a RecyclerView instance in the adapter method?

I have implemented a rewarded ad feature in my app, where clicking on a lock icon shows an ad and on successful completion of the ad, I want to replace all the lock icons with copy icons in the entire list. However, the current code I have for…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
1
vote
2 answers

I can access my fun inside the ViewHolder from the adapter

I try to call fun bind declared in the inner class LaunchesViewHolder from onBindViewHolder() but I got error "Unresolved resource bind" I was trying with an other variable x, just to see, same problem class LaunchesAdapter(private val dataSet:…