I’m new to Android development and it’s been a long time since I’ve done any Java either (great start..).
I’m not looking to do anything fancy – yet, I’m just looking to bind a Cursor to the ListView – through a SimpleCursorAdaptor.
I’ve already got my main class extending “Activity” so most of the sample source code doesn’t really apply. They seem to want to extend ListActivity instead.
Right on the first app screen, I’ve got a listview that needs to show the data in my database. I’ve got a DB helper that will happily return a cursor with the database values in it. So the real question is – without extending the ListActivity class – how on earth do I do it?
There’s no code in this question as it’s just the simplest thing in the world and I’m sure some advice from someone who knows what they’re doing would be sufficient. Note also that I’ve tried creating a new class in my project that does extend ListActivity and called that but I still don’t know how or when or where the binding takes place. It doesn’t allow me to use “setListAdapter()” to my listview – it only allows setAdapter() which crashes the thing.
Any help would be greatly appreciated.
You can extend the class with Acitivity that define ListView in the layout xml with id
@+id/blahblah, then find the ListView id in the Activity class. Set the Adapter using