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

java.lang.ArrayIndexOutOfBoundsException: length=22; index=-1

i am very new to Android Studio and making app with my WordPress website and using Rest Api to fetch data from my website , all works fine and i have added sort posts menu in my app and users can sort posts by "most views" "most commented" etc. and…
0
votes
0 answers

How to show ProgressBar after AdMob ads in Adapter?

i am making android app using Rest Api and date getting from my WordPress Website , all works fine , i have added AdMob ads between content and when its loading page 2 from page 1 there is ProgressBar showing that "Posts Are Loading" at the bottom ,…
0
votes
2 answers

ViewPager (RecyclerView) with custom item count doesn't update data properly

I've created an adapter (extending ListAdapter with DiffUtil.ItemCallback) for my RecyclerView. It's an ordinary adapter with several itemViewTypes, but it should be smth like cyclic, if API sends flag and dataset size is > 1 (made by overriding…
0
votes
1 answer

a personal adapter error with observer pattern

I have a problem with my personal adapter. When I search through the Observer pattern for information in a local database, it brings me the records but the adaptare is not called until you make a second attempt to delete and add the same petra to…
0
votes
0 answers

ImageView and TextView assigned incorrectly in onBindViewHolder

Expected outcome: I want to show only ImageView and TextView that corresponds to the current position e.g if I have val icons = craftingExpandableList[position].requiredList?.icon val amounts =…
Cuyer
  • 95
  • 8
0
votes
0 answers

how to sort recyclerview based on the values set through itemView and not on the basis of values fetched from helper class

I have calculated distance between two locations inside adapter but now I cannot sort the RecyclerView based on distance. Because the calculated distance is not from helper class. Following is the Code from Adapter Class: public class MyAdapter…
0
votes
1 answer

Update value in an activity from an adapter (Kotlin)

New to Kotlin and to OOP in general I have a TextView in my MainActivity which is linked to a var var int = 0 findViewById(R.id.textView).setText("$var") The thing is I want to modify this var inside and adapter. class Adapter( var…
Elsouk
  • 3
  • 2
0
votes
0 answers

How to get data from firestore using intent object

I am having some issues with the intent object. I already retrieved it with the new Activity but it doesn't work when passed to Firestore queries. The passed extra is for other users to get details of other users for a View. If I use the current…
0
votes
0 answers

When I try to load audio and images from the API into the media player and image view in ViewPager2, they do not appear in the order they were loaded

When I try to load audio and images from the API into ViewPager2's media player and image view, they don't load in the correct order; audio is sometimes different from their image and text when loaded in ViewPager2 (for example, if I slide down or…
0
votes
0 answers

How to identify swipe up/down in ViewPager 2 using Kotlin

I am trying to get notified if the user swipes up or down on the viewpager. View Pager is showing a list of data coming from an API. I have been through few answers here on SO including this but they seems a little complex and have very little…
oyeraghib
  • 878
  • 3
  • 8
  • 26
0
votes
1 answer

How to select only one checkbox within 2 recyclerviews

I got 2 recyclerviews on a fragment. Both recyclerviews contain items and checkboxes. Only a single checkbox should be selectable within the two recyclerviews. So if a checkbox is selected, all other checkboxes should be switched off IN BOTH…
yasyes
  • 1
  • 2
0
votes
0 answers

Calling a method in the main activity from class adapter

Here is my code in my AddClassAdapter recylerview using firebase below on "onBindViewHolder": holder.editBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { UserClasses userClasses = new…
0
votes
0 answers

I implemented ADS in recycler view every 3 items but repeats the first 3 items everytime

I tried implementing ADS in recycler view every 3 items but instead of following the next items in the list of items, it repeats the first 3 times over and over until the list.size() is over. AdMob , ad item in Recycler View hides some items and…
0
votes
1 answer

Adding toast on FirebaseRecylerView Adapter specifically on "onBindViewHolder"

I have a problem displaying toast on an RecylerViewAdapter with firebase. I was gonna use it on an image button which is delete as you can see below the onBindViewHolder. But the problem is, getContext doesn't work public class AddClassAdapter…
0
votes
1 answer

Issue Ranking the user when Searched via Search Box in Recycler View

I am trying to figure out how to display the filtered(searched) list with the correct rank as displayed in the recycle view at the beginning ... So, what i am trying to say is: (Issue Link)…
Jadu
  • 489
  • 3
  • 10