Created
September 27, 2017 14:45
-
-
Save husaynhakeem/e1c6047dcbdb795e6452496d6f3b165a 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