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

Cannot set adapter in onComplete method Facebook SDK, ANDROID

I cannot set an adapter to my GridView called "lista". This is my Activity: public class ListaAmigos extends Activity { private String TAG = "ListaAmigos"; protected static Context context; private GridView lista; @Override public void…
1
vote
1 answer

How do I implement an InfoWindowAdapter interface in Xamarin?

I am using Xamarin and I am wanting to create a CustomWindowAdapter that implements a GoogleMap.InfoWindowAdapter interface. I have tried this so far: public class CustomWindowAdapter : InfoWindowAdapter { } I am getting this error: Error CS0246:…
1
vote
2 answers

How can I remove listview items after a few seconds?

How can I add a timer with every item of the listview? I want the row to disappear after two seconds. The list contains only strings I currently have a handler in my adapter with handler.postDelayed(new UpdateTimerTask(), 2000); inside the…
1
vote
1 answer

Blank image in Gallery view – Android

I know about gallery view is outdated, but i still need it. I've tested it on Nexus 7, Samsung S4, LG phones and it works fine, but on HTC phone I got blank place instead some images in Gallery, like this: Here is a sample of code:
Anton Kashpor
  • 1,255
  • 2
  • 18
  • 34
1
vote
1 answer

Is there a way to add two textviews to arrayadapter

I want to use two textviews side by side in my listview and also want to perform search on them. Is there any way to do this without creating any new class? Here is what I have done so far: public class MainActivity extends Activity { final String[]…
user3234390
  • 97
  • 4
  • 10
1
vote
2 answers

onListItemClick() error: it must override or implement a supertype method

I am a beginner in both Android and Java. I searched for an answer to this error, but nothing in stackOverflow worked for my situation. I am following a book that says we need to use a onListItemClick() method that is from a class…
Azurespot
  • 3,066
  • 3
  • 45
  • 73
1
vote
3 answers

Exception in adapter when trying to inflate layout

I'm trying to inflate a layout in my getView method of my adapter: Here is the error: 01-18 20:58:04.873: E/AndroidRuntime(21583): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView 01-18…
EGHDK
  • 17,818
  • 45
  • 129
  • 204
1
vote
2 answers

How to force a Gridview to NOT reload the adapter after screen rotation

Everytime I rotate the phone´s screen, the adapter of a gridview gets reloaded. I have this on my manifest (android:configChanges="orientation|keyboardHidden|keyboard|screenSize") and I know it´s working as it should: the oncreate() is not…
1
vote
3 answers

Why can't I select an EditText in a ListView?

I have a simple ListView where each item is an EditText. However, whenever I try to start typing in one of the EditText's, it is immediately unfocused (leaving the soft keyboard up). Debugging shows that getView() is being called many times when I…
cstack
  • 2,152
  • 6
  • 28
  • 47
1
vote
2 answers

android - How to sort List>

I am using a simple adapter to fill a listview, I can't find how to order items by a specific attribute of the groupData, here is my code: public class LibraryFragment extends Fragment { private Context mContext; private ListView…
user3119384
  • 329
  • 4
  • 23
1
vote
0 answers

Getting data from Parse and populating a ListView with it

I am getting data from Parse.com and I want to populate it in a ListView dynamicly. Here is my approach: public class CategoryFragment extends Fragment { private OnFragmentInteractionListener mListener; ArrayList categories; // TODO:…
user1178729
1
vote
2 answers

Array adapter with custom subclass objects

The solution is in the bottom: I made some classes that i want to use in a listview. They look like this: public class Equipment{ ....code.... } and public class Weapon extends Equipment{ ...More code... } and public class Armor…
Furedal
  • 523
  • 2
  • 8
  • 19
1
vote
2 answers

Android Listview row repeating item

I have a list where on specific number(position) that i get from shared preferences an imageview should be shown(indicates what song is currently playing) . But i get the position,but that item is showing on other rows as well. The problem is…
Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117
1
vote
1 answer

Disable state changes in views within ExpandableListView when clicking them

Background when you create your own custom views for listView, you can have a checkBox (or any other view that has "state_pressed" for its drawable) inside that will only be shown as touched only when it's really the one that is clicked , instead of…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
1
vote
2 answers

Listview cursor adapter, always get first item onClicked

I have this piece of code for listview using simple cursor adapter : final SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), R.layout.textonly_listview_item, cursor, from,…