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
7
votes
1 answer

getResources from FragmentStatePagerAdapter

Inside an activity class, I have this class (from android samples): public static class DemoCollectionPagerAdapter extends FragmentStatePagerAdapter { public DemoCollectionPagerAdapter(FragmentManager fm) { super(fm); } …
7
votes
2 answers

Save State and Restore State in FragmentStatePagerAdapter

I a using ViewPager with FragmentStatePageAdapter on my screen I have 5 pages which has lots of images and views. Currently I have mViewPager.setOffscreenPageLimit(1); so only current, previous and next will be in memory and other 2 will be…
7
votes
2 answers

Generic adapter for many kinds of listview 's layout row in android

For each list view with difference row layout template, I must create each custom adapter, which do the same thing: load xml row layout, get control (TextView, ImageView, etc..) by id, display data... something like this: public class CommentAdapter…
ductran
  • 10,043
  • 19
  • 82
  • 165
7
votes
2 answers

Android creating AlertDialog using values from ArrayList?

I am using following code to create a Dialog aleart box with lists item from studentNames ArrayList.I am creating this ArrayList by reading childfile array.But when this code runs it just display a Dialog box with zero list item.I have even check my…
Anshul
  • 7,914
  • 12
  • 42
  • 65
6
votes
1 answer

Admob Native ads in RecyclerView android

I am facing this issue with my Recycler view while placing admob ads Problem: It is actually replaced the item from the list and place the ads After apply this solution recommended by one of the stack-overflow member the problem occur How to place…
6
votes
2 answers

Getting icon from url and icon from drawable it is taking only from drawable

I have added some manually icons to drawable which for some manually data it have to take the drawable and if a icon is not in drawable then take it from the Glide. I tried something like till now but only it is getting the icons from drawable. I…
TheCoderGuy
  • 771
  • 6
  • 24
  • 51
6
votes
1 answer

Android 8.1/9.0 removeView(View) is not supported in AdapterView

I'm getting a "removeView(View) is not supported in AdapterView" exception when running my app in Android version 8.1 and 9.0. In previous versions it runs fine. Although the error is consistent it doesn't happen 100% of the time (which makes me…
Vallette
  • 284
  • 2
  • 6
6
votes
5 answers

Data binding in adapter of recyclerView - Android

I am using dataBinding in my project to populate a RecyclerView. How can I handle clicks on items? Here is my XML layout:
6
votes
1 answer

RecyclerView with background image at top

What I'm trying to achieve is this: As you can see, there is a background image that appears slightly behind the first card in the RecyclerView. When the user scrolls, the background image, as well as the "Discover" text and icon, should also…
6
votes
1 answer

Firebase RecyclerView infinite scroll

I'm looking for a way to implement infinite scrolling in my Firebase app. I'm retrieving my data the following way : I have a list of keys (items a user created, items a user liked and stuff like this) that I am sending to an adapter which gets the…
6
votes
2 answers

How to display a date like Whatsapp on scrolling ListView

How can I show dates in an app when I scroll the ListView like in WhatsApp? See the below image for clarity: When I scroll the ListView, the date gets displayed over the list. If you still did not understand my question please open your WhatsApp,…
6
votes
1 answer

Dynamically change count of PagerIndicator in ViewPager or PagerAdapter

What effect I want to have is : number of Bottom Circle indicator must be half of page count when page width is half. number of Bottom Circle indicator must be as much as page count when page width is full. also, there is an another request: can…
6
votes
3 answers

In MVP structure which class responsible for keep list items and how to notify data change in this

I trying to refactor one of my activity class to implement mvp(using mvp mosby library) . I have a RecyclerView and in this view there is some items that some changes apply to them during the run time. for example I do some I/O operation and change…
Siavash Abdoli
  • 1,852
  • 3
  • 22
  • 38
6
votes
3 answers

How to update listview when back pressed from another activity android?

Hi how to update listView when back pressed in another activity. I am using database, where i am deleting particular row in one Activity, if back pressed alone, it's not updating. When i switch over to some other activity or app closed and open it's…
Star
  • 735
  • 3
  • 13
  • 34
6
votes
2 answers

Call transition animation from RecyclerView Adapter instead of Activity

I have an app with a RecyclerView filled with some cards, with help of a custom RecyclerView (RV) Adapter I made. I then tried to follow this tutorial in order to add a transition between activities. However, as shown in the tutorial, the animations…