I want to create one static object, that can be used in whole program. So I have this class for sql.
private static FeadReadDB myInstance;
public FeadReadDB(android.content.Context context){
super(context, DB_NAME, null, DB_VERION);
myInstance = this;
}
public static FeadReadDB getInstance(){
return myInstance;
}
In first, I didn't have this getInstance function, but when I wrote it, and change code, I got null pointer exception. Is it possible to create something like this, let's say, init this myInstance
, at beginning of program and then use in rest of program ( activities )?