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

Recyclerview onCreateViewHolder called for every item

I have a RecyclerView inside a NestedScrollView that show some data downloaded asynchronously. The problem is that there is a significant lag when the items are initilized. After some tests I found out that the problem is that onCreateViewHolder is…
materight
  • 527
  • 8
  • 22
7
votes
1 answer

Twitter Android SDK not executing Callback

I'm running this code with a Twitter handle I'm pretty sure doesn't exist in order to test error handling. The breakpoints on the Callback are never hit, neither for success nor failure. Any pointers on why this is? Just as a note, this code works…
zundi
  • 2,361
  • 1
  • 28
  • 45
7
votes
4 answers

Understanding RecyclerView.ViewHolder

I'm having hard time understanding working of view holder, here are my some question that could increase my understanding of viewholder: It is said that oncreateViewHolder returns viewholder object, What is viewholder object does it contain all the…
blackHawk
  • 6,047
  • 13
  • 57
  • 100
7
votes
7 answers

RecyclerView does not update after removing an item

I have a RecyclerView horizontal image slider at the bottom of a fragment. The top of the fragment shows some details. Once the user clicks on the images at the bottom, the idea is to remove that image from the image slider and display its…
7
votes
1 answer

Best way to notify RecyclerView Adapter from Viewholder?

I have a RecyclerView with multiple item view types so they are broken into separate ViewHolder classes. Before, when all the ViewHolders were in the same class as the RecyclerView Adapter, I could update the adapter directly when an item was…
7
votes
1 answer

Updating RecyclerView item ProgressBar without calling notifyItemChanged(int) on adapter

I am trying to update a progressBar which is the part of one of the RecyclerView items. I know I can do it in two ways, Method 1: By refreshing the item row by calling notifyItemChanged(position) Method 2: By accessing the view using the method…
7
votes
3 answers

RecyclerView OnClick not working

I have made a horizontal recyclerview inside a fragment. Now when I click on any item I don't see the on click listener working. Here is my code for the Adapter class: public class FeaturedProductsAdapter extends…
Akshay Bhasin
  • 167
  • 2
  • 3
  • 11
7
votes
3 answers

RecyclerView programmatically click

I'm trying to programmatically click on an item of a recyclerView. I'm using: recyclerView.findViewHolderForAdapterPosition(index).itemView.performClick(); This perfectly works when the index is of a visible item. If the item is not visible (at …
helloimyourmind
  • 994
  • 4
  • 14
  • 30
7
votes
2 answers

How to notify an Adapter in a Fragment from Activity?

I have a TabLayout in mainActivity with some tabs, tabs are Fragments. And on each Fragment I have a ReclerView. From the main Activity I want to call notifyDatasetChange() on my Adapter in my Fragment for updating the UI. But how to notify…
javadroid
  • 1,421
  • 2
  • 19
  • 43
7
votes
2 answers

android-notifyDataSetChanged doesn't work on BaseAdapter

i've a listview on my activity , when I reach the end of listview , it calls async and it getting new data using json . this is the async and baseAdaper codes : ListAdapter ladap; private class GetContacts AsyncTask
Navid Abutorab
  • 1,667
  • 7
  • 31
  • 58
7
votes
3 answers

Update GridView/ListView without re-populating

whenever you update a GridView/ListView you call notifyDatasetChanged on the adapter which re-populates the the list with the new data removing everything that was currently in the list. now take this little video for example from the L Preview…
tyczj
  • 71,600
  • 54
  • 194
  • 296
7
votes
4 answers

Remove item from custom listview on button click

I have a custom listview, that has 2 textviews and 2 buttons (play and delete button) I want when I click the delete button to delete the current line. My adapter class import java.util.ArrayList; import android.content.Context; import…
Boldijar Paul
  • 5,405
  • 9
  • 46
  • 94
7
votes
1 answer

How to resolve "The content of the adapter has changed but ListView did not receive a notification” exception

I found a lot of questions on the same topic. But I am unable to figure out what I am doing wrong here. Exception: "The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not…
7
votes
3 answers

How to Refresh ListView in Fragment that is filled with BaseAdapter?

I want to Refresh a ListView in a Fragment when a Dialog is closed. Until now the refresh only works when I restart the app and I don't really know why. Here are the classes: This is the Fragment with the ListView on it, that i want to refresh, when…
7
votes
2 answers

ListView like in universal image loader sample app

I am using universal image loader for displaying thumb images in the list view. I have implemented the basic steps in the adapter and everything is working. The problem is if i have 10 items in the list and i can see first 5 as soon as i scroll…
Ravi
  • 4,872
  • 8
  • 35
  • 46