Questions tagged [android-arrayadapter]

A concrete BaseAdapter that is backed by an array of arbitrary objects.

From the documentation of the ArrayAdapter class:

A concrete BaseAdapter that is backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource.

However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list.

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want.

Tag Usage:

4383 questions
1
vote
1 answer

Can an arrayadapter be notified after clicking a button in dialog

I have an array adapter that displays a list if items. I am creating a list of items for user to select in a dialog and when the user selects the items from that list and when he clicks "Ok " button on the dialog box I want the array adapter to be…
Prens
  • 420
  • 1
  • 5
  • 15
1
vote
4 answers

unable to retrieve data from sharedpreferences using loop and arrayadapter

I am trying to use SharedPreferences to store data from an ArrayList. But I am lost. I am using a for loop to retrieve the data and store it in the listview. Also when I press the button the preferences are stored. package…
1
vote
0 answers

ArrayAdapter retains views on Android 4.3

This only happens on Android 4.3, physical device and virtual emulator. I have a list view that I fill with a custom adapter https://github.com/markholland/ocw-android/blob/development/src/org/osuosl/ocw/Schedule.java#L1509 When I change screens and…
Mark Holland
  • 127
  • 1
  • 10
1
vote
1 answer

Custom Adapter for ListView with semi-complex list item

I am trying to make an Activity that basically holds a list on song items that are "semi-complex." The output of one list item can be found here. I found what seemed like a good example online to follow to create such a thing, and that could is…
1
vote
2 answers

ListView does not display with custom adapter class

I have an Apple class with two fields, colour and rotation, and an AppleView View which draws the apple in that colour and rotation in its onDraw method (this is a simplification of my actual code). The AppleView has a default apple (let's say, red…
1''
  • 26,823
  • 32
  • 143
  • 200
1
vote
1 answer

In android how to display data from xml file using xml pull parser on a listview?

I'm a new Android programmer and recently, I am parsing xml file using pull parser in ListView. but i am failing to do the same. please suggest me how to do that. my actual code is MainActivity.java package com.example.simplexmlpullapp; import…
1
vote
2 answers

Converting an ArrayAdapter to a List

I have an array adapter(string), and would like to convert it to a List, but after a little googling and a few attempts, I am no closer to figuring out how to do this. I have tried the following; for(int i = 0; i < adapter./*what?*/; i++){ …
jcw
  • 5,132
  • 7
  • 45
  • 54
1
vote
1 answer

Android - How to filter a listview on multiple values?

I want to filter a listView on song title and artist. Currently I have a working filter on song title. But I can't figure out how to filter on song title and artist at the same moment. This is my…
gdingenen
  • 303
  • 3
  • 12
1
vote
1 answer

Android: NullPointerException onItemClick in ListView after adding new item to list

Here is some code, that I cannot fix myself. I made a custom ArrayAdapter, to populate my ListView with TextViews containing players' names. It works as intended when the whole list of player names is specified before the adapter is instantiated.…
1
vote
2 answers

EditText in ListView using ArrayAdapter

I've a ListView that displays a single button and a single EditText in each ListView row. I'm using the ViewHolder pattern in my ArrayAdapter so all the buttons share a single OnClickListener. Picking up the button click is easy because…
Martin
  • 139
  • 4
  • 12
1
vote
2 answers

Android Constructor is Undefined

I try to use a ListView inside a ViewPager, and I can't create the adapter. It basically crashes. I have this code (made of eclipse's template): public class WeeklyActivity extends FragmentActivity { /** * The {@link…
1
vote
0 answers

HOW TO disable getView() method in ListView Adapter?

Is there any way to disable getView() method in ListView Adapter when I use MotionEvent.ACTION_MOVE in OnTouchListener?? I need to do because i try move my conteiner(inside is my ListView) by finger. I use for this method setLayoutParams: …
1
vote
1 answer

Populate Spinner with String Array

I'm trying to populate a spinner with a string array using an array adapter on my android application. The code appears sound to me, hence me asking the wonderful community at SO. Here is my populating function: private void populateSpinners(String…
Freestyle076
  • 1,548
  • 19
  • 36
1
vote
1 answer

Android ArrayAdapter with multiple objects?

Can I set an ArrayAdapter < Object > or ArrayAdapter < String > with multiple objects? I have a ListView Item with an Icon and a TextView. I can use this to set the TextView names: mDrawerList.setAdapter(new ArrayAdapter( …
KickAss
  • 4,210
  • 8
  • 33
  • 41
1
vote
5 answers

Clear( ) ArrayAdapter not working properly - Android

I have a ArrayAdapter that gathers information from an AsyncTask. The AsyncTask is triggered by an on scroll listener. When the user scrolls to the bottom of the content the AsyncTask is triggered and loads more content. The problem is I have…
1 2 3
99
100