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
12
votes
5 answers

Custom adapter getview is not called

I have a Custom adapter with a ListFragment but the adapters getView() is not getting called at all. This is how the adapter looks like - public class ModuleListItemAdapter extends BaseAdapter { List list; Context context; …
Akilan
  • 924
  • 1
  • 7
  • 19
12
votes
5 answers

How to use Universal Image Loader

I have a requirement where I need to load thumbnails and a Text in ListView which gets set by the custom Adapter. The Thumbnails should be stored in a cache memory, for that I am using the Universal Image Loader however I am pretty much confused in…
12
votes
3 answers

Can't set OnCheckedChangeListener to a Checkbox

I am trying to set a OnCheckedChangeListener to a CheckBox but my application exits in the run time. I also tried to set listeners for my TextView and I still get the same result. Can anyone help? import android.app.ListActivity; import…
Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83
11
votes
1 answer

RecyclerView - How highlight central visible item during scroll

I need a RecyclerView like this: It should does: show 7 items per time (DONE) center the RecyclerView on the central visible item (DONE) when I scroll to right/left, the central item will be "highlighted" (the button is selected > blue color)…
eldivino87
  • 1,425
  • 1
  • 17
  • 30
11
votes
2 answers

Force RecyclerView to call onCreateViewHolder

I have a RecyclerView that can show items as list, small grids or large grid and this can be change at runtime. Depending on what style user chooses i inflate different layout in onCreateViewHolder. I also use layoutManger.setSpanSizeLookUp() to…
Alireza Ahmadi
  • 5,122
  • 7
  • 40
  • 67
11
votes
2 answers

No adapter attached; skipping layout

logcat error : No adapter attached; skipping layout I changed the context argument with getActivity(), but the app is still not running. public class FragmentActivity extends Fragment { private RecyclerView mRecyclerView; private…
11
votes
2 answers

RecyclerView - Where should I handle its click events?

Prior to the introduction of RecyclerView (and its mandatory ViewHolder pattern), I usually delegate any click events to its corresponding Activity/Fragment using setOnItemClickListener(). (Because I mainly see Activity/Fragment as a "controller"…
Hadi Satrio
  • 4,272
  • 2
  • 24
  • 45
11
votes
2 answers

ViewPager fragments recreation, are resumed but not visible

I have an issue with a ViewPager + FragmentPageAdapter. Scenario: I have one Activity with inside a Fragment A. Fragment A has a ViewPager with Fragment B1 e Fragment B2. B1 e B2 are the same class, but different data as…
Noodles
  • 3,263
  • 4
  • 19
  • 22
10
votes
2 answers

Android RecyclerView Adapter Item count is returning 0 on unit testing

I am trying to test RecyclerView with AndroidJunit4, it is my test code: @Rule public ActivityTestRule rule = new …
dev_android
  • 8,698
  • 22
  • 91
  • 148
10
votes
3 answers

"RecyclerView: No Adapter attached; skipping layout" for recyclerview in fragment

I'm getting this error but I don't know what is causing it...perhaps something to do with the fact that this is being initialized in a fragment and not in the activity itself. Edit: included StatsAdapter code public class StatsFragment extends…
10
votes
2 answers

RecyclerView - No animation on NotifyItemInsert

For some reason, when adding a new item to the RecyclerView (should be inserted to the top of the list), it won't show up unless I scroll down the list and back up to the top, and without any animation either. (Just appears at the top of the list as…
10
votes
2 answers

android - listview filter count

So after I set the filter on my listview: //Log adapter count before filter listView.getFilter().filter(searchStr) //Log adapter count after filter What I'm trying to achieve is to get the count of the result of that filtering. Like if before…
lorraine batol
  • 6,001
  • 16
  • 55
  • 114
9
votes
2 answers

Different row layouts in ListView

This post is related to this ViewHolder not working. On that post, I was following a tutorial on how to use ViewHolder on a ListView. What I want now is to have the last item on a ListView to have a different layout than the rest. Here's my…
9
votes
6 answers

Create Base Adapters For All Recycler View Adapters

public abstract class BaseAdapters extends RecyclerView.Adapter implements View.OnClickListener { protected Context parentContext; public int layout_id; protected List dataList = new ArrayList<>(); …
PRATEEK BHARDWAJ
  • 2,364
  • 2
  • 21
  • 35
9
votes
2 answers

RecyclerView Databinding Item click

I am trying to listen for row clicks (item clicks) on my recycler view from the Activity itself (not from adapter). My Adapter so far looks like this: public class ListMiestnostiAdapter extends…