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

RecyclerView GridLayoutManager with multiple view type, Viewholder cast Exception

So I am following this tutorial and I have a RecyclerView with GridLayoutManager implementation.The GridLayoutManager has 2 columns. I want to have two view types,so I am using two ViewHolders that extends the RecyclerView.ViewHolder and I am…
0
votes
0 answers

How dynamically add custom listViewItem to listView?

I am using CursorAdapter and ViewHolder to upload data from database to listView. But now I need dynamically add some custom item to bottom of the listView without using cursorAdapter(not from database) and after that - update listView. here is my…
0
votes
3 answers

How to determine the number of checkboxes that can be checked in Android?

hi I have checkboxes inside a listview I have eight choices, and I want the user to be able to check only four, then lock the checkboxes unless he unchecks one. This my Main: public class Ch2 extends Activity implements OnItemClickListener{ …
chaos
  • 21
  • 5
0
votes
1 answer

Applying and Creating Multiple Views For GridViewLayout

Im attempting to add two different views to the GridviewLayoutManager using a custom adapter. However, I cant seem to reference the headerview correctly. When the onbindViewHolder is called it is expecting a "ViewHolder" response, however i really…
PowerMan2015
  • 1,307
  • 5
  • 19
  • 40
0
votes
1 answer

ViewHolder doesn's work anymore after retrieve data from JSON

Everything work fine before i implement the json things. When i click the detail button(imageView), dialogFragment should be pop up. It is okay with the pop up, the problem is, it's generate two or more dialogFragment. Is implement json affect the…
0
votes
2 answers

Android ListView and custom adapter with ViewHolder

I'm having a problem with my ListView adapter displaying items in my ArrayList... For the most part, it seems to work... the view is correct for each item... however, the validation seems to get screwed up when I implement the (convertView ==…
0
votes
1 answer

RecyclerView.Adapter Class Query

While researching on the RecyclerView.Adapter class I came across this line of code: public class MyAdapter extends RecyclerView.Adapter I am aware of the underlying concept of Adapters and ViewHolders.But I am curious…
ghostrider
  • 2,046
  • 3
  • 23
  • 46
0
votes
0 answers

RecyclerView is drawn before its data set is updated

I have a fragment in which I have a RecyclerView: public class AlarmListFragment extends Fragment{ public AlarmListAdapter alarmListAdapter; RecyclerView recyclerViewAlarms; public AlarmListFragment() { } @Override public View…
0
votes
1 answer

Android: ListView with RelativeLayout -> NullReference

I'm trying to implement a ListView relative layout using a ViewHolder. In getView(), I'm running into a NullReference. I've modeled the code after an example I found here on Stack Overflow. Here's the code: private ViewHolder mViewHolder; public…
0
votes
1 answer

Custom holder adapter error

I'm trying to implement a listView with a checkbox as part of a bigger app. When I tried to start the activity, I got a nullPointer error but I'm not able to find out what's going wrong. Maybe my AsyncTask doesn't return a true value? Here is the…
aries_93
  • 5
  • 2
0
votes
3 answers

Android - ViewHolder in Gridview not working

I am new in programming ad I'm on my first app, so excuse me for my ignorance... and also for my english. I have a GridView with images, and i'm trying to implement a ViewHolder to improve performance. Here's the code. xml for imageView dimensions: …
0
votes
1 answer

RecyclerView onBindViewHolder onclicklistener behavior

I am trying to load a recycler view that lists cards, each card has four elements. two text views(posttext, score are the id) and two buttons(minusOne and plusOne). The code below loads the textview's content and buttons properly on all cards. I…
55597
  • 2,033
  • 1
  • 21
  • 40
0
votes
2 answers

Listview Optimization for data fetched from the Database

I'm very new to android and seeking for help about listview optimization for data fetched from the database. "I want to check the boxes and then press the get button to show them in a toast." with SimpleCursorAdapter : package…
babiro
  • 95
  • 2
  • 11
0
votes
0 answers

setVisiblitiy to an ImageView according to SQLite table column value

Im doing an app in Material Design and my goal is to get items form SQLite database and if an item row boolean is_checked is 1, then display this item with an ImageVIew in RecyclerView. I know this explanation is bit off so here is my code:…
Ollikas
  • 199
  • 1
  • 3
  • 14
0
votes
1 answer

How to get BaseAdapter getTag id for each index in Android?

I am trying to write a BaseAdapter code where i want to get ViewHolder Tag id on each onClickListener , but in each index i am not getting the ViewHolder tag id , it is always giving the first ViewHolder tag id. If there will be 10 items then , if i…