Why does everybody love to extend the listAdapters?
Just use the SimpleAdapter it takes an array of textviews.
http://code.google.com/android/reference/android/widget/SimpleAdapter.html
Here's an example with a curor simple adapter that does exactly what
you want except with 2 textviews instead of 3.
"// Now create a new list adapter bound to the cursor.
// SimpleListAdapter is designed for binding to a Cursor.
ListAdapter adapter = new SimpleCursorAdapter(
this, // Context.
android.R.layout.two_line_list_item, // Specify the
row template to use (here, two columns bound to the two retrieved
cursor rows).
mCursor, // Pass
in the cursor to bind to.
new String[] {People.NAME, People.COMPANY}, // Array
of cursor columns to bind to.
new int[]); //
Parallel array of which template objects to bind to those columns.
// Bind to our new adapter.
setListAdapter(adapter);
"
from - http://code.google.com/android/reference/android/app/ListActivity.html
hmmmm the "to" array seems to be empty in this example....
You will have to replace "android.R.layout.two_line_list_item" with
your own layout that has 3 text views and of course have 3 text views
in the "to" array
more examples:
http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/view/List7.html
http://code.google.com/android/intro/tutorial-ex1.html
hope that helps
On Apr 29, 3:38 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> kingkung wrote:
> > Is there a simple way to do this through a listAdapter, like
> > ArrayAdapter, etc.? The way I see it, an ArrayAdapter is only able to
> > fill in ALL of the textview A's first, and then all of the textview
> > B's, and then all of the textview C's. But there are clearly some
> > entries which don't have all three text views, and hence the array
> > would leave an empty space for that entry.
>
> Create your own subclass of ArrayAdapter and override getView(). It will
> be called for each one of your visible entries (#1, #2, #3, etc.).
> There, you can construct your own View that includes whichever of A, B,
> or C you need and return it. Those Views will then go into your overall
> ListView.
>
> To create your own per-item Views, you can either build and connect them
> in Java, or create a separate layout XML file for the items and use the
> ViewInflate class to give you Views based on that layout, which you can
> then fill in and customize (e.g., make unused ones invisible).
>
> --
> Mark Murphyhttp://commonsware.com
> The Busy Coder's Guide to Android Development -- coming in June 2008!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---