Created
July 17, 2017 01:01
-
-
Save thatfiredev/cf5441098ae629d26669fba171fcdcbb to your computer and use it in GitHub Desktop.
Utilizado no artigo Android Architecture Components - LiveData: https://medium.com/@rosariopfernandes/aac6-b46de8513df8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.rosariopfernandes.aac; | |
import android.arch.persistence.room.Database; | |
import android.arch.persistence.room.Room; | |
import android.arch.persistence.room.RoomDatabase; | |
import android.content.Context; | |
/** | |
* Created by rosariopfernandes on 6/15/17. | |
*/ | |
@Database(entities = {Tarefa.class}, version = 1) | |
public abstract class BaseDados extends RoomDatabase { | |
private static BaseDados INSTANCE; | |
public static BaseDados getDatabase(Context context) { | |
if (INSTANCE == null) { | |
INSTANCE = | |
Room.databaseBuilder(context.getApplicationContext(), | |
BaseDados.class, | |
"arch_components_db") | |
.build(); | |
} | |
return INSTANCE; | |
} | |
public abstract TarefaDAO tarefaDao(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment