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);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---