Nevermind,  I found the solution...  The final fillData function does
exactly what I need.  Hope this helps someone...

private void fillData(){
        Cursor c = mDbHelper.fetchAllClients();
        startManagingCursor(c);

        // Set Client Row Title
        String[] from = new String[]{ FinanceDbAdapter.KEY_TITLE,
FinanceDbAdapter.KEY_BODY };
        int[] to = new int[]{ android.R.id.text1, android.R.id.text2};

        // Now create an array adapter and set it to display using our row
        SimpleCursorAdapter clients = new SimpleCursorAdapter(this,
android.R.layout.two_line_list_item, c, from, to);
        setListAdapter(clients);
    }

On Thu, Mar 19, 2009 at 1:18 AM, sddandroid <sddm...@gmail.com> wrote:

>
> I am trying to fill the data in two text views in a single row (see
> xml) and am trying to use SimpleCursorAdapter to do it.  As I
> understand the function, it is allowed to take an array of strings and
> an array of ids which you see in the list below.  When I run the
> application from the phone, it errors out at start (the client view is
> the default view to show which is where this function is executed
> from).  Can anyone fill me in on what I am missing?
>
> XML
> <?xml version="1.0" encoding="utf-8"?>
> <TextView
>   xmlns:android="http://schemas.android.com/apk/res/android";
>   android:layout_width="fill_parent"
>   android:layout_height="60px">
>   <TextView
>       android:id="@+id/client_row_title"
>       android:textSize="20px" />
>   <TextView
>       android:id="@+id/client_row_body"
>       android:textSize="10px" />
> </TextView>
>
>
> private void fillData(){
>       Cursor c = mDbHelper.fetchAllClients();
>       startManagingCursor(c);
>
>       // Set Client Row Title
>       String[] from = new String[]{ FinanceDbAdapter.KEY_TITLE,
> FinanceDbAdapter.KEY_BODY };
>       int[] to = new int[] { R.id.client_row_title,
> R.id.client_row_body };
>
>       // Now create an array adapter and set it to display using our
> row
>       SimpleCursorAdapter clients = new SimpleCursorAdapter(this,
> R.layout.client_row, c, from, to);
>       setListAdapter(clients);
>   }
> >
>


-- 
Mike Garcia

There is no coincidence!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to