Proyectos de Subversion Android Microlearning

Rev

Rev 1 | Rev 10 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
package com.cesams.twogetskills.dao;
2
 
3
import android.content.Context;
4
 
5
import androidx.room.Room;
6
 
7
import com.cesams.twogetskills.Constants;
8
 
9
public class DatabaseHelper {
8 gabriel 10
 
11
    //Control de cambio de capsula
12
    public static String CambioSlide = "NO"; // SI o NO
13
 
1 efrain 14
    private static DatabaseHelper _INSTANCE = null;
15
    private AppDatabase appDatabase;
16
 
17
    // other instance variables can be here
18
 
19
    private DatabaseHelper(Context context) {
20
        appDatabase = Room.databaseBuilder(
21
                context.getApplicationContext(),
22
                AppDatabase.class, Constants.DATABASE_FILENAME
23
        ).allowMainThreadQueries().build();
24
    };
25
 
26
    public static DatabaseHelper getInstance(Context context) {
27
        if (_INSTANCE == null) {
28
            _INSTANCE = new DatabaseHelper(context);
29
        }
30
        return(_INSTANCE);
31
    }
32
 
33
    public AppDatabase getAppDatabase() {
34
        return appDatabase;
35
    }
36
}