All --
I am using a Simple cursor adapter to show my data in my ListActivity
and the list is showing up blank. What am I doing wrong. When I get
the query from the database it is returning 114 rows. When I do a
adapter.getCount() it also returns me 114 rows. But on my app I see
114 blank rows in my list. I checked to see if I am mapping the the
to and from arrays properly in my SimpleCursorAdapter constructor and
it seems like I am. Any help would be appreciated :) Here is my list
activity code:
public class HelloAndroid extends ListActivity {
private QDbAdapter dbAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MetaDataHandler dh = new MetaDataHandler();
setContentView(R.layout.main);
FileInputStream fIn = null;
dbAdapter = new QDbAdapter(this);
dbAdapter.open();
if (dbAdapter.suraCount() != 114)
{
try {
dbAdapter.deleteAll();
dh.parseMetaData(this);
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
fillData();
dbAdapter.close();
}
protected void onListItemClick(ListView l, View v, int position,
long id) {
super.onListItemClick(l, v, position, id);
}
private void fillData() {
Cursor c = dbAdapter.fetchAllMetadata();
startManagingCursor(c);
System.out.println(c.getCount());returns 114 rows
ListAdapter adapter = new SimpleCursorAdapter(this,
R.layout.row, c, new String[] {QDbAdapter.TNAME},new int[]
{R.id.index1});
System.out.println(adapter.getCount()); //returns 114 rows
Object o = adapter.getItem(0); //this returns a SQLLite
cursor object that has data
setListAdapter(adapter);
}
}
Here is my layout code for the list row:
<?xml version="1.0" encoding="utf-8"?>
<TextView id="@+id/index1" xmlns:android="http://schemas.android.com/
apk/res/android"
android:layout_width="wrap_content" android:textSize="12pt"
android:layout_height="wrap_content"/>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---