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

Create adapter with dual horizontal items

I've a listview with custom adapter with 2 custom layouts, it works perfectly, but the data has a trouble. The flow of data is only vertical, I need "change" the flow of data when the layout of adapter have 2 items, like this: Any one can help?
Pedro Paulo Amorim
  • 1,838
  • 2
  • 27
  • 50
1
vote
2 answers

Sorting alphabetically type of hashmap ANDROID

After implementing the Hashmap I realized that it was not sorted alphabetically so now I wanted to know if there's another map that sorts the files for me? I tried using the code above but it says that I can't use sort in my listview type public…
1
vote
1 answer

ArrayAdapter with Filter crashes

I have my own ArrayAdapter and inside of this adapter class I have a Filter. In this filter I am overriding the publishResults(CharSequence constraint, FilterResults result) method. @Override protected void publishResults(CharSequence…
1
vote
1 answer

Display Bitmap images in a GridView

In Xamarin, I have an Activity that has a GridView and a list of image web addresses. A list of Bitmap objects are retrieved and then displayed in the GridView from these web addresses. Here is my MainActivity code: public class MainActivity :…
Simon
  • 7,991
  • 21
  • 83
  • 163
1
vote
2 answers

SectionedListView android error inflating class include

Im trying to create a sectioned listView using this tutorial, but im keepeing on getting this error in logCat: 06-18 13:26:47.538: E/AndroidRuntime(9294): FATAL EXCEPTION: main 06-18 13:26:47.538: E/AndroidRuntime(9294):…
Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117
1
vote
2 answers

Making the background color of button change and persist after a click

I have a ListFragment that contains a Button in every list item. When the Button is clicked, the colour of the Button changes (using a Drawable xml resource). Though the color of the Button changes during the click event, its color changes back to…
1
vote
4 answers

Why the compiler ask me declare a variable "final" when I use the method "OnClickListener" on adapter class?

I have an adapter class, I have a checkbox in this layout and with "OnClickListener" method I try to declare "check = true" but the ADT ask me declare a final the ViewHolder This is my adapter class public class MaterialAdapter extends…
TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
1
vote
2 answers

Add an OnClickListener on an imageView inside each ListView element

I have a ListView with a custom Adapter and a Layout defined in item_song.xml. Inside each element, I have 3 TextViews and one ImageView. I want to implement an OnClickListener on the ImageView inside each element. I've tried implementing…
1
vote
0 answers

Expandable ListView Adapter getChildrenCount NPE

I need to implement expandable ListView, but I have null pointer exception in adapter at getChildrenCount() line of the code. Here is the code of adapter: public class DigitalMenuListAdapter extends BaseExpandableListAdapter { private Context…
Zookey
  • 2,637
  • 13
  • 46
  • 80
1
vote
2 answers

Updating multiple spinners

I have a listView containing some Spinners. I want to update the Spinners when I select an item. For example: Spinner 1 : {A, B, C} Spinner 2 : {1, 2, 3, 4, 5} Spinner 3 : {a, b, c, d, e, f, g, h} If I select A, I want to have: Spinner 1 : {A, B,…
leb1755
  • 1,386
  • 2
  • 14
  • 29
1
vote
1 answer

android checkbox in custom adapter for show cab

I've tried to implement contextual action bar(cab) using custom adapter. First, I made simple ListView with cab and it worked. Second, I tried to make custom adapter contains CheckBox and TextView. CheckBox for cab, but it didn't work. public class…
1
vote
1 answer

Android CustomListAdapter notifydatachange() is not working

I want to disply list of items using Custom ArrayAdapter. I will insert data by clicking a button. MainFragment.java @Override public void onClick(View v) { DatabaseClass feed = new DatabaseClass(getActivity()); new…
Cnu Federer
  • 398
  • 3
  • 9
1
vote
1 answer

Add items to gridview during runtime instead of replacing previous items

I've followed this tutorial to get a gridview that displays images using a custom adapter: http://www.mkyong.com/android/android-gridview-example/ I've adapted the code to show the images when an nfc card is presented to the phone, however if I…
user3578602
  • 25
  • 1
  • 4
1
vote
1 answer

ListView displaying list item twice

I am new to Android. I am developing a Notepad application.The NoteList displays every list item twice. I don't know why is showing that.I think it has something with onLoadFinished method, but I'm not sure.Here's my code : **NoteList.java ** public…
1
vote
0 answers

Saving GridView state in a Fragment (Android) on Back Button

In my android application, I am switching between the two set of images-(Set1, Set2) displayed in a GridView-A inside a Fragment-A.I am doing this on a button press using a boolean variable. Clicking on any GridView icon leads to another Fragment-B.…