Category : android-room

I added below cade for adding column to the ‘SithluBody’ table wen migration. static final Migration MIGRATION_3_4 = new Migration(3, 4) { @Override public void migrate(SupportSQLiteDatabase database) { database.execSQL("ALTER TABLE SithaluBody ADD COLUMN has_thumb INTEGER NOT NULL DEFAULT 0"); database.execSQL("ALTER TABLE SithaluBody ADD COLUMN reacts TEXT"); } }; but I got the error ==> Fatal ..

Read more

How can I set the default value of some fields from resources like strings . because I want set value for different languages @ColumnInfo(defaultValue = "") // R.string.someword private String publisher; When trying to : @ColumnInfo(defaultValue = Resources.getSystem().getString(android.R.string.someword)) private String publisher; Get the following error Attribute value must be constant Source: Android..

Read more

I am unable to set value to LiveData variable which is declared as MutableLiveData. The value i am trying to set is LiveData returned from repository. Please find below the classes. Viewmodel.class // Variable to hold list of tasks Livedata private val _tasks=MutableLiveData<List<TaskEntity>>() val tasks:LiveData<List<TaskEntity>> get() = _tasks init{ getTasksFromDb() } private fun getTasksFromDb(){ viewModelScope.launch ..

Read more

I’m trying to use Android Room 2.3.0 and I’m currently getting the compile errors below: ProjectDao: error: Not sure how to handle query method’s return type (java.lang.Object). DELETE query methods must either return void or int (the number of deleted rows). public abstract java.lang.Object deleteAllProjects(@org.jetbrains.annotations.NotNull() error: Query method parameters should either be a type that ..

Read more

Using room I’m trying to have an object of type Something, that contains a list of Stuff, and each item of that list contains another list of Things. data class rootWrapper( @Embeded var somethingEntity: SomethingEntity @Relation( parentColumn = "id", entityColumn = "idSomething", associatedBy = Junction(SomethingWithStuffEntity::class) ) var listOfStuff: MutableList<StuffWithThingsInsideWrapper> ) data class StuffWithThingsInsideWrapper( @Embeded var ..

Read more