Delete using inner join with composite primary key

All we need is a simple explanation of the problem, which is provided below. I am trying to delete some records from my database, I have succeeded and it works when testing in "DB Browser for SQLite" software but when I try to copy it to my Android Studio project I get this error in … Read more

POJO within POJO, Entity-Relation problem

All we need is a simple explanation of the problem, which is provided below. I have five tables in my database: AREA, AREA_TYPE, SAMPLE, PACK, UNIT @Entity(tableName = "AREA") data class AreaEntity( @PrimaryKey val id:String, val title:String, @ColumnInfo(name = "area_type_id") val areaTypeId:Int, @ColumnInfo(name = "is_active") val isActive:Boolean ) @Entity(tableName = "AREA_TYPE") data class AreaTypeEntity( @PrimaryKey … Read more

How to load a different database file with Room?

All we need is a simple explanation of the problem, which is provided below. Goal I have an app with plenty of data, with a switch button, which switch the language (french or english) of the entire app. However, some of my data are stored in a Room database. I have two .db files : … Read more

Why not auto update list when used LiveData in Android

All we need is a simple explanation of the problem, which is provided below. In my application I want use Koin , Room and LiveData. I write below codes, but after add new item into room not auto update recyclerview list! Should close app and open again for show updated list ! Dao codes : … Read more

How to delete selected item from RoomDB

All we need is a simple explanation of the problem, which is provided below. I want to create a To-Do app, where you can add, edit and delete notes. So my question is, how can I delete item selected with checkBox from database? App doesn’t crash but only Toast message appears nothing else happens. Here … Read more

onCheckedChanged is called whenever viewHolder is recycled

All we need is a simple explanation of the problem, which is provided below. I am writing a todo list application and, in particular, I want the value of the checkBox to be stored in the database every time it is changed. I set this feature by adding setOnCheckedChangeListener in onBindViewHolder @Override public void onBindViewHolder(@NonNull … Read more

Room database insert function kotlinx.coroutines.JobCancellationException

All we need is a simple explanation of the problem, which is provided below. I’ve got some simple code like this: PlansDao @Dao interface PlansDao { @Insert(entity = PlanDbo::class) suspend fun insertPlan(planDbo: PlanDbo): Long } Repository class PlansRepositoryImpl @Inject constructor( private val plansDao: PlansDao ) : PlansRepository { override suspend fun writePlan(plan: PlanDbo) { Log.d("MAIN_TAG", … Read more