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

Viewholder not working for a custom adapter

Below is the code for my custom list adapter with for listview. The adapter works perfectly if I comment out the "not null" token in my code,that is without my view holder. Can someone help me with the problem I have here? public View getView(int i,…
0
votes
2 answers

ClassCastException in adapter with 2 layouts

I have a adapter that has inflates two layouts(one for separator,one for normal items), but when I run the app I get this in logCat: java.lang.ClassCastException: com.myapp.android.adapter.ModelItemAdapter$ViewHolderSeparator cannot be cast to…
0
votes
1 answer

Adapter with ViewHolder - loop

I have a problem with my custom ListView adapter. I want to use ViewHolder (since my listview has 100+ elements), but my listview loops when I use my code. By looping I mean it shows only the initial position and loops their appearance until end of…
0
votes
2 answers

The GridView items changes after scrolling

I have a girdview that displays, image and text, when scrolling the gridview, the order of images changes, the text keeps correct, but the images changes. I used the Viewholder pattern m but still having the same problem.. below is my…
Adham
  • 63,550
  • 98
  • 229
  • 344
0
votes
2 answers

Reset alignment in holder in viewholder pattern

I'm trying to use the viewholder patter to improve the speed in my listviews. Everything works ok, but I have a problem with the alignment of a TextView. This is the XML of the TextView I'm having problems with:
0
votes
1 answer

Holder onClick() taking action on wrong rows

I have an Custom ArrayAdapter for a listview that has multiple buttons. But when i click a button in a row its action with wrong row. Example; when i clicked first row's button, it click action is working for another row. getView codes here: public…
0
votes
1 answer

ViewHolder not working(one more repeating)

Have problem with repeating items reaction to click in custom adapter list view. Actually method in onClick applying for clicked element and if i scroll down my list some of elements repeats the same. So when i'm try to solve it with Tag its not…
once2go
  • 1,452
  • 1
  • 13
  • 21
0
votes
0 answers

Delete item in listview and then refresh it

I have the following code that implements a button that removes an item in a listview. I use a sharedpreferences variable to store values (url) that points to images displayed in the listview. Each image has this button that lets to remove it from…
0
votes
1 answer

How to preserve edittext value in custom cursor adapter

After applying almost all answers from stack overflow on same topic but i can not find solution for my problem. my problem is i have a list view which contain a question and a edit text in each row. but when i scroll list view data in edit text…
0
votes
2 answers

How to implement ViewHolder pattern with separator?

I have a list view that displays two different kinds of data one is a separator. Each data type is stored in one array list. Thus there are two lists. The content of each list is separated from the other one by a special row (separator). The first…
null
  • 1,369
  • 2
  • 18
  • 38
0
votes
1 answer

Reference to another item inside a ListView with ViewHolder

I need a little bit of help: I have a listview with a custom list item and a viewholder. The code I copied represents the adapter I am using but a simplier version. For the sake of simplicity, lets say I have an ImageView and a LinearLayout inside…
Jani Bela
  • 1,660
  • 4
  • 27
  • 50
0
votes
1 answer

Pulling entry from Customer List Adapter of Custom List View for new intent

I am trying to click on a list entry. My List is a custom list view, with the data pulled from an ArrayAdapter. The list shows 3 parts of the Array entry, and a picture, but i want to send those items and the rest of the array entry to the next…
0
votes
1 answer

Get Tag values in array of checked items in android listview

This is my ContactsAdapter class from which am displaying the list with Checkbox. Here am able to get the Tag of checked items. There is another class FanFragment in which on click of a button(ContactList) I must get all the values of Tag in Array…
0
votes
4 answers

ListView causing OutOfMemory Error

So I am not really given a reason to the right of this error message. I am not exactly sure why this is happening but my guess though is that it has to do with the fact that there are around ~50 good quality drawables. Upon scrolling really fast,…
Michael
  • 83
  • 9
0
votes
1 answer

Android ImageButton in ListView row clicklistener not responding

I have a ListView with rows that contain ImageButtons (shown as 'O' below): [<-------TextView-------> O O O] [<-------TextView-------> O O O] I am finding that the first row has intermittent behaviour. At first it appeared that the image button…