Questions tagged [android-adapter]

An Adapter object acts as a bridge between an AdapterView and the underlying data for that view.

An Adapter represents the connection between a View with some kind of data source. Adapters generally come in two flavours: those representing array/list based data and those that represent Cursor based data.

  • The Adapter provides access to the data items.
  • The Adapter is also responsible for making a View for each item in the data set.

See Adapter reference for more information.

Tag Usage:

3394 questions
0
votes
0 answers

Why do i lose values ​after scrolling in Recycler View?

Whenever I add multiple items, for example more than 7 and that's scroll to the top. The top items are lost. When I go back down the bottom items are also lost After entering the data, if i scroll after adding the item as scrollable, the data…
0
votes
0 answers

How to make checkbox selection in a dialog with RecyclerView affect only the current row in the parent RecyclerView?

I have a parent recycler view with multiple items and two buttons for each view. If I click the button that I have highlighted, a dialog with another recycler view pops up which has checkboxes populated dynamically via api. I have created an array…
0
votes
0 answers

How to create one horizontal and one vertical RecyclerView with headings in a parent RecyclerView using Kotlin?

I am currently using one recycler view which is Parent and vertical scrolls in home fragment, I search through resources but as learner I cant find anything useful, I WANT TWO RECYCLERS_VIEW WITH HEADINGS (ONE IS HORIZONTAL SCROLL(on top) AND SECOND…
0
votes
1 answer

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 occuring in my Activity's Adapter

When I started the MainActivity, my app crashed and returns the error : java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 on my stack trace. Here's my adapter code: class MainAdapter: PagingDataAdapter
0
votes
1 answer

RecyclerView isn't displaying any items

My recyclerView isn't displaying any items. I'm not getting any errors though so I'm not sure what the problem is. Here is the code. MainActivity.java package com.example.recyclerviewexample; import androidx.appcompat.app.AppCompatActivity; import…
Lux
  • 15
  • 3
0
votes
1 answer

Can someone tell me why it gives me an error when I try to use "absoluteAdapterPosition" in a Recycler View in Kotlin?

It tells me there is a mismatch, it requires "AdapterView<*>! but it has found "Int". How do I fix this? class InstructorViewHolder(itemView: View, listener: OnItemClickListener) : RecyclerView.ViewHolder(itemView){ val firstName: TextView =…
0
votes
2 answers

Andriod - RecyclerView not printing items as expected

I have a bug RecyclerView where items are not coming as expected. RecyclerView is using multiple ViewType (Category and items) but Currently, The adapter is printing items like this. (The Category & Items doesn't seems to be mapped…
GeekWithGlasses
  • 572
  • 2
  • 12
  • 30
0
votes
2 answers

RecyclerView with CheckBox does not keep selected items

I have a list with RecyclerView + Adapter + ViewHolder and each item list contains a description and a CheckBox. If I select an item and scroll down the list RecyclerView does not keep the selection when I scroll up again. Here is my code: class…
0
votes
1 answer

Is there a way I can setAdapter and setMessage at the same time for MaterialAlertDialogBuilder?

I want body text to appear above a list of views inside dialog from MaterialAlertDialogBuilder. I tried setting body text and adapter but it only resulted in showing the body text, ex1. MaterialAlertDialogBuilder builder = new…
0
votes
0 answers

How to know recyclerview visible items which exist another recyclerview? (Nested recyclerview impression)

I have recyclerview. This recyclerview has view holder which has another recyclerview. Both recyclerview orientation is vertical. What I'd like to do is listen child recyclerview impression event. In other words, I'd like to listen child…
Enes Zor
  • 973
  • 8
  • 14
0
votes
1 answer

How to show Interstitial ad after 3rd post in Android Studio?

i am making app with Android Studio using Wordpress as backend and fetching posts via json api .. now i want to implements AdMob interstitial ads in my app but don’t want to show ads for every post because it will violate AdMob's policy . what is…
0
votes
0 answers

Unable to populate listview fragment from array of string

I am unsure where I am going wrong. I have used an array before to populate a listview and had no issues. Now that I am using a fragment I receive errors that I am unable to fix. I log to find where the error is and the application only crashes when…
deeko
  • 5
  • 2
0
votes
0 answers

RecyclerView content disapears on device rotation

Im doing an activity to show a profile that contains some cards with sports related to it, the idea is to see three cards at a time and be able to scroll the cards to see the next ones. This is the code on the profile activity where I take the…
0
votes
0 answers

Variable 'singleChoiceAdapter' is accessed from within inner class, needs to be final or effectively final

I created a function with name setRecyclerViewSingleItems so that i can restrict the user to select only one option from the given options ( those options are stored in arrrayList ). I want to create this function such that i can do this multiple…
0
votes
1 answer

Get the Margin top of a clicked item in a listview

I have a problem with the setSelection of a Listview that I fill with Adapter. I use setSelection when I return to a list of items, after I have clicked on an item to see the detail (view2)or edit its information, and then also edit what I show in…
Kevin
  • 415
  • 3
  • 8
  • 21