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
votes
2 answers

Can;t we pass int value to recycler view in Java?

i created a class for temp data to show. Obviously my app is crashing but if i change int sno to String sno then there is no problem. i want to know for int, if yes then how? public class Contact { public int sno; public String phone; …
-1
votes
1 answer

Change color of selected item in recyclerview (Java)

I am working on this app for a school project, and it's the first time I am using java to develop an app. I created a recyclerview in order to show multiple orders from a list. What I wanted it to do is, when it has been clicked, then change the…
-1
votes
1 answer

Android RecyclerView card menu button onClick not triggered with SelectionTracker

Context I have a list of RecyclerView cards that are selectable by clicking on them. I'm using SelectionTracker and ItemDetailsLookup to keep track of which cards have been selected. Everything is working great. Now I added an overflow context menu…
-1
votes
1 answer

How to implement onClickListener for a specific element inside RecyclerView itemView in Kotlin Android?

I want to implement an onClickListener for the followButton inside an item in a RecylerView. I haven't managed to find any tutorial/question which uses the way I followed and am completely clueless about the required approach in Kotlin. Here is the…
-1
votes
1 answer

Android Kotlin : null cannot be cast to non-null type com.android.app.ui.category.CategoryAdapter.ViewHolder want to insert admob in recycleviewholder

with limited understanding of the Kotlin programming language, I tried editing the code that was previously running normally. my goal is to add admob banner between the recycleview data that is already running well. I have tried it for 1 week or…
-1
votes
3 answers

How to make checkboxes visible in RecyclerView on a button click from activity?

I have a button and a recycler view in an activity. Inside each row of the recycler view (viewholder in adapter class), I have an invisible checkbox. What I want to happen is when the user clicks the button, the checkboxes in each row should become…
-1
votes
3 answers

How to make specific background for list item?

How can I make a list item have such a blue background when clicked? Here is code from my fragment when i click on item: override fun onListItemClick(itemIndex: Int, itemCode: String, itemViewId: Int) { val connectionGuid =…
Morozov
  • 4,968
  • 6
  • 39
  • 70
-1
votes
2 answers

Read data in activity of recyclerview adapter

I have a recyclerview with a card and spinners in it, the values selected in the spinner I need to send it to the next activity to calculate estimated price. I have a button in the activity which is not of the recyclerview, that takes me to next…
Abhishek AN
  • 648
  • 7
  • 24
-1
votes
1 answer

how to send an object from a ViewHolder class to another Activity

So I want to send an object (Person) to the Main Activity from another one which is using a recyclerView with a ViewHolder, then close the activity using the viewHolder and print the text on a textView of the Main Activity, I didn't know how to send…
-1
votes
1 answer

RecyclerView adapter `onCreateViewHolder` & `onBindViewHolder` invoked only once

I have a RecyclerView.Adapter like this: internal class MyAdapter : RecyclerView.Adapter() { private val data: List = SeedData().seed() override fun onCreateViewHolder(v: ViewGroup, viewType: Int): MyViewHolder…
IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
-1
votes
1 answer

Java - Recycleview ViewHolder OnClick not working also the viewholder.category_name.settext is not working

I have Tried the below code but viewHolder.category_name.setText() is not working also the viewHolder.setItemclickListener is not working Code of Category Fragment package com.kunal.quiz; import android.content.Intent; import…
-1
votes
2 answers

how to add a listener to a view holder to prevent it from gets recycling under different conditions

I'm working on an application for a barber shop and I have a list of orders some of them for adults and other for children so when the user chooses a service for a person and presses Add I show the the price but whenever the list grows and I remove…
-1
votes
1 answer

Radio buttons looses values when scrolling in RecyclerView

Please help me spot the bug! I have read numerous posts here on this issue but I can't get mine to work. To me it looks like I'm doing it according to the other solutions but I'm missing something. I have a survey implemented as a question with 3…
-1
votes
2 answers

how to add a onclicklistner in a view holder

I want add a onclicklistner in my viewholder and I don't know how to add it inside the view holder,when the user click the item it should pass the value I want to fix a onclicklisner inside usersviewholder ,i don't know how so i need some experts…
-1
votes
3 answers

How to be redirected to another activity when clicked on ViewHolder that contains a RecyclerView?

I'm using a RecyclerView to display some data. For each item I have a custom layout which holds beside some text views a RecyclerView: