Created
September 27, 2017 14:46
-
-
Save husaynhakeem/cc9a2a94a7d7aa20da08ce863d1432a0 to your computer and use it in GitHub Desktop.
This file contains 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
@Database(entities = {Pokemon.class}, version = 1) | |
public abstract class PokemonDataBase extends RoomDatabase { | |
private static final String POKEMON_DB = "pokemon.db"; | |
public abstract PokemonDao pokemonDao(); | |
private static PokemonDataBase pokemonDB; | |
public static PokemonDataBase getInstance(Context context) { | |
if (pokemonDB == null) | |
pokemonDB = Room.databaseBuilder(context.getApplicationContext(), PokemonDataBase.class, POKEMON_DB).build(); | |
return pokemonDB; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment