I want to use a singleton pattern to hold a database and some other data/methods for my Android application.

I realize there are many reasons against singletons, but for this case I'd like to use it.

I've sub-classed UIApplication and made a data class within it called MyAppData.

MyAppData needs to have access to the SQLite database.

When I create the databse, I need to pass a context. I could pass the application context, but it will not directly relate to MyAppData.

I don't know if this wlll cause problems with my code.

So my thought is to have MyAppdata extend android.content.ContextWrapper. I don't think I should extend Activity because it's really not an activity, its a data class with methods to access the database.

I'm wondering if I extend ContextWrapper will there be something deep in the code I'm missing that will cause big problems down the road (memory leaks, etc).

This may not be the ideal approach to this (and I've considered other options), but my goal is to:

Have a singleton class in UIApplication that can encapsulate the database and be retrieved easily from any activity in my app.

Thanks in advance for your suggestions/warnings/advice.