System services not available to Activities before onCreate?

I would bet that you are trying to create a CursorAdapter in the Constructor of your Activity.

Context is not available in the Activities Constructor, it is only available in the Activity.onCreate() method and beyond.

And for a top tip…

Create the CursorAdapter with a Cursor of null in Activity.onCreate() and use ListView.getAdapter().changeCursor(newCursor) to assign newCursor once a background thread has returned a populated Cursor.

Leave a Comment