When i write my singletons i always provide a getInstance(Context) method in the singleton Class. But which context object should i pass to that method: Activity context (the this in the Activity class) or the Application Context? And what differences it would make if i pass one or another?
To illustrate, i have a database manager that have the getInstance method defined like:
public static Database getInstance(Context context) {
if (Database.instance == null)
instance = new Database(context);
return instance;
}
And the constructor looks like:
private Database(Context context) {
this.sqLiteDatabase = context.openOrCreateDatabase(...);
}