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 flavors: those that represent 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:

3159 questions
0
votes
2 answers

ViewPager2 adapters - difference between FragmentActivity / Fragment / FragmentManager

I noticed in this ViewPager2 video that there are 3 different ways of declaring an adapter with Fragments. What's the difference between them and which 1 should be used for swipe views with tabs using ViewPager2? Option 1 (recommended) class…
SD826E
  • 6,673
  • 7
  • 45
  • 92
0
votes
0 answers

Adapter does not update

When switching to Detail, the RecyclerView list is not updated, but rather, I get a blank screen when returning as in the picture. I know that when using NavigationUI, Fragment is recreated. In the code below, returning results in ruleAdapter! =…
0
votes
1 answer

How do I get the quantity from every item in cart and pass to an activity?

i have a cartactivity and cartadapter, in cartadapter i add increment and decrement for each stuff, and i sum it in total price and total weight and send it to activity ( it worked by passing textview activity from cartactivity to adapteractivity )…
0
votes
2 answers

RecyclerView List items not displaying nor playing

After coding a recyclerView MediaPlayer, the item lists refused to display after testing with emulator. I don't know what to do. Please your help is very important to me. All the codes below is what i tried that didn't work. This is the…
Joseph
  • 310
  • 2
  • 14
0
votes
1 answer

When changing list item layout RecyclerView scrolls to top

In my RecyclerView OnLongClicking an item I want to change that item's layout by setting some TextViews to View.GONE and others to View.VISIBLE. Everything works except that when I long press the item and the layout changes my RecyclerView scrolls…
0
votes
0 answers

getView function function in adapter class is running in infinite loop, after fetching profiles from the server?

My adapter code public class profiles_adapter extends ArrayAdapter { Context context; public profiles_adapter(Context context, int resourceId, List items) { super(context, resourceId, items); this.context =…
kaku
  • 37
  • 1
  • 7
0
votes
1 answer

is there a way to create fragment from a activty-adapter imagebutton?

i need to create a fragment from activty-adapter on imagebutton click and to pass 3 data along having trouble with fragment or it says android.app.Application cannot be cast to android.app.Activity please help someone code is in the image code i…
0
votes
0 answers

Put a vertical viewpager just showing items, within a recyclerview

I'm hoping someone can show me the ropes of hopefully ViewPager2, but I'm basically in need of making a viewpager where I can swipe between different images. I will have a category, let's call it Category A. Category A can have multiple items in…
0
votes
1 answer

Recycler view adapter now displaying data in fragment

I am trying to display data from my database in my fragment through recycler view. I used a for loop to go through all the users in my database. All the users who are neither friends nor have sent requests should be displayed as implemented in the…
0
votes
1 answer

Pass variable to adapter from class

I am trying to pass a string variable from a fragment class to its adapter. The code written in the fragment class is : public class RequestPendingFragment extends Fragment { FirebaseUser firebaseUser =…
0
votes
1 answer

Removed item from Adapter not rearanged

I'm making an app that adds to a cart a bunch of items, now, I have this UI that adds an item with the + button and deletes it from the array if I press the - button when 1 is at the quantity. I have an array of items (ITEM A, ITEM B), I can add…
CoffeeBreak
  • 2,283
  • 10
  • 36
0
votes
0 answers

Is there some adapter listener in Android recyclerView?

I wanna change checkedTextView's boolean state in activity when some event occurs in adapter(Maybe RecyclerView). I thought the way using getter and setter first, but that's not good idea. So I thought listener. Is there listener can get event in…
0
votes
1 answer

How the textViewResourceId assigned by android while using ArrayAdapter

I am new to Android so forgive me if this is an obvious one, i am still trying to understand the workflow. I am following a tutorial and I have created a listView and an ArrayAdapter. ArrayAdapter adapter = new…
0
votes
1 answer

how settext item adapter using tag html like description?

I want to setText with Divider a conversation based on the tag in the adapter like a photo What should I do?
parisa
  • 1
  • 2
0
votes
1 answer

dataSnapShot.getValue() returns null eventhough data exits in the database

I am using Firebase as a back-end system and I am also using the Recycler View for displaying the data to the user. But when fetching data from the database the getValue() method returns null. I have attached my code below: public class Post { …