I created a game in Android Studio and now I am trying to insert a score in a database. I created a Script in SQL that creates well the database but now I'm trying to insert information but I don't have a context.
This is my DBAdapter:
public class DBAdapter {
private SQLiteDatabase database;
private ScriptSQL dbHelper;
private String[] allColumns = {ScriptSQL.ID, ScriptSQL.PONTUACAO};
public DBAdapter(Context ctx) {
    dbHelper = new ScriptSQL(ctx);
}
public void open() throws SQLException {
    database = dbHelper.getWritableDatabase();
}
public void openRead() throws SQLException {
    database = dbHelper.getReadableDatabase();
}
public void close() {
    dbHelper.close();
}
public Score createScore(String pontuacao) {
    ContentValues values = new ContentValues();
    values.put(dbHelper.PONTUACAO, pontuacao);
    long insertId = database.insert(dbHelper.TABLE_NAME, null, values);
    // To show how to query
    Cursor cursor = database.query(dbHelper.TABLE_NAME, allColumns, dbHelper.ID + " = " + insertId, null, null, null, null);
    cursor.moveToFirst();
    return cursorToScore(cursor);
}
This is the non activity class that I'm trying to get the Context.
World.java
public class World {
static final int WORLD_WIDTH = 10; //largura
static final int WORLD_HEIGHT = 13; //altura
static final int SCORE_INCREMENT = 10; //incremento do score
static final float TICK_INITIAL = 0.8f; //velocidade inicial do jogo
static final float TICK_DECREMENT = 0.2f; //velocidade de decremento
public Dog dog;
public Elements element;
public boolean EndGame = false;
public int score = 0;
static int put_element = 0;
public List<Elements> elements = new ArrayList<Elements>();
Random random = new Random();
float timeTick = 0;
static float tick = TICK_INITIAL;
public World(){
    dog = new Dog();
}
/*...*/
DBAdapter datasource;
private Context context;
public void update_database(){
    datasource = new DBAdapter(context.getApplicationContext());
    try {
        datasource.open();
        String point = Integer.toString(score);
        Score c = datasource.createScore(point);
        datasource.close();
    }
    catch (SQLException ex) { }
}
The problem is on the line:
datasource = new DBAdapter(context.getApplicationContext());
I tried to do it this way too but it gives an error because this is a non activity class.
datasource = new DBAdapter(this);
What can I do?
 
     
    