M
M
max_vr2016-05-26 11:03:00
Java
max_vr, 2016-05-26 11:03:00

What context to specify when working with sqlite in a separate class?

I'm new to Java programming so don't judge too harshly. I decided to create a sqlite database, made a separate DB class, described the database in it. The constructor has a standard form:

public DB(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

Then I decided to write several methods for working with this database in a separate class, and I ran into the following question: what context should be specified when creating a database instance?
public class data  {
    DB db;
    public void initialize(){
        db = new DB(???);
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergiu3dmd, 2016-05-26
@sergiu3dmd

getContext()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question