listadapter

ListActivity with checkbox in Android

I am trying to use ListActivity and a SimpleCursorAdapter to check boxes based on a query from a database. The cursor is a list of questions and answers. If the user has already answered a question the checkbox should be checked but they aren't checked. The code looks like this: protected void onCreate(Bundle savedInstanceState) { s...

Android: ViewHolder pattern and different types of rows?

ViewHolder pattern improves ListView scrolling framerate, as seen in following example: http://developer.android.com/intl/de/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html Is it possible to keep this pattern while using different kind of Views for different rows? In other words, is it possible to do something ...

Android - How to Get a Layout Inflater Given a Context?

Hi, i am writing a custom implementation of a ListAdapter. In its constructor, i'm taking in a Context, a resource ID (i.e. R.id.xxx representing the layout file), and a list and a map (these contain the data). Now, the problem is that i will need a LayoutInflater to get the View object which is in the separate layout XML file. How c...

android: how do i perserve the data in my arrayadapter/listview when change orientation?

as above, is it done automatically? My list was empty once the orientation chMYanges? and nope, i need the orientation change =) My adapter public class ResultsAdapter extends ArrayAdapter<SearchItem> implements Filterable{ private ArrayList<SearchItem> subItems; private ArrayList<SearchItem> allItems;// = new ArrayList<SearchItem>();...

Is there a super simple List / ListAdapter example out there for android

I have a web service that returns a super simple list of objects MyObject[] data = webServiceCall(); MyObject has 1 field i want to display, "Name" (i.e. data[0].Name ) How can i turn this into an activity that lists just the name of these objects in a scrollable listActivity in android. I am getting really confused with Cursors an...

List view and list adapters for displaying json

Hi, I am trying to display the text from json in a list view. I got help for retrieving the json text from the following... http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/comment-page-1/#comment-498.... But my problem is that i cant figure out how to display them in list view. I also want to get ...

Android ListView with Checkbox: automatically unchecks

Hi, I've got a ListView with a custom BaseAdapter. The list items contain CheckBoxes that need to represent a property from a database. I use CheckBox.setOnCheckedChangeListener with a new OnCheckedChangeListener to detect changes, so I can change the database based on the current state of the CheckBox. Pretty straightforward stuff so ...

How to call notifyDataSetChanged() from a generic Adapter

An OnItemClickListener for a ListView has the following method: @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) I'd like to have the adapter behind the ListView refresh, and I believe this is done through the use of: BaseAdapter.notifyDataSetChanged() How do I use the parent parameter in the ...

ListAdapters and WrapperListAdapter algorithm

This logic is written in a function with signature private void showDialog(final AdapterView<? extends Adapter> parent, String title, String message, final Tag subject) Is there a better way of doing this? // refresh adapter SimpleCursorAdapter adapter; if (parent.getAdapter() instanceof WrapperListAdapter) { adapter = (Simp...

Android: how to set click events on ListView?

Hey there, I'm looking to be able to open up a new view or activity when I click on an item in my ListView. Currently I have a list of restaurants, and when i click on a particular restaurant I want it to open up another screen that will show its address, google map etc. What I need help with is knowing how to set click events on the ...

Where are graphically pleasing examples of Lists

Anyone know of good code examples of how to make lists look different than your everyday average black list or more graphically pleasing than you usually see in android apps. I've looked through google code but haven't found too many. I'm looking for different and eye catching lists. I hope this question isn't too generic. Also i'm o...

Return empty row in Custom ArrayAdapter?

Hi, when my ListView is being filled by a custom Array Adapter, I check for a certain parameter in the current list item, and if it is false, I want to return an empty row. At the moment, I am doing this by inflating an empty xml file, but that creates ugly list item dividers when a number of items should not be shown, and is obviously ...

Android: ListActivity design - changing the content of the List Adapter

Hi, I would like to write a rather simple content application which displays a list of textual items (along with a small pic). I have a standard menu in which each menu item represents a different category of textual items (news, sports, leisure etc.). Pressing a menu item will display a list of textual items of this category. Now, h...

Android: custom view layout for SectionIndexer and disabling SectionIndexer on the fly

Is it possible to use custom view as a section indexer? I.e. make it more transparent and use images instead of characters? Is it possible to enable/disable SectionIndexer popup on demand without disabling FastScroll feature? ...

Android listadapter Anchor

Hello all, Lets say I have 1 - 1,000 in a list and I click on 250. When I push the back button I want to go back to 250 not all the way back up to 1. Is this possible? ...

How can I manage the height of android spinner items?

I have an android spinner that's populated by a list of strings using an ArrayAdapter and it operates fine, however because of the way the spinner is displayed I'm running into a display height problem with the list items. At first glance it would seem that the ArrayAdapter can use a single layout for displaying options which leads to t...

call setListAdapter() from inside a thread

Hi, I have a problem with my ListActivity, i use a thread to show a ProgressDialog where get a list of all installed applications. I turn it into a list adapter and than i want to set the listadapter of the activity but i can't do that from the thread. I get the following error: ERROR/AndroidRuntime(14429): android.view.ViewRoot$Called...

Refreshing a listview

I have a listview that's populated by rows that get their data from a web server. It all works totally fine except I want to have a refresh button to re-download the data. I'm getting the data through an asynctask (getting the data in doinbackground) and then setting the listadapter in onpostexecute. All I do to run the asynctask which s...

Want to load part of an array into android ListAdapter

My code works like this to list all items in my String array - itemsarray setListAdapter(new ArrayAdapter<String>(this, R.layout.row, R.id.label, itemsarray)); However, I know by this call that I only want to list the first X number of items from itemsarray. How can I load only the first X items form itemsarray into the ListA...

Need to get the ID of audiofile in android

I can load a list with the following code String[] projection = new String[] { Audio.Media._ID, Audio.Media.DATA, Audio.Media.DISPLAY_NAME}; audioCursor = this.managedQuery(Audio.Media.EXTERNAL_CONTENT_URI, projection, null, null, Audio.Media.DISPLAY_NAME + " ASC"); startManagingCursor(audioCurs...