I am using Room API to implement a DB in my Android app. It seems that every time I load my app it tries to create the database again and again. Is there any way to restrict
when you create database it call when application start that time their db create.you used to below code in app activity and that activity call in manifest file in application class call like used below code ..
public class AppActivity extends Application {
AppDatabase db;
@Override
public void onCreate() {
super.onCreate();
db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "database-name").build();
}
public AppDatabase getDatabase() {
return db;
}
} and add below line manifest file .. add below line in application tag
android:name="AppActivity"