在我的房間應(yīng)用程序中,我在 populateDatabase 函數(shù)中收到兩個(gè)警告:從不使用參數(shù)“pbInfoDao”,從不使用變量“pbInfo”任務(wù):app:prepareLintJar 最新任務(wù):app:generateDebugSources 任務(wù):app:javaPreCompileDebug 任務(wù):app:compileDebugJavaWithJavac 任務(wù):app:compileDebugSources 任務(wù):app:mergeDebugShaders 任務(wù):app:compileDebugShaders 任務(wù):app:generateDebugAssets 任務(wù):app:mergeDebug資產(chǎn)我將如何解決這些問(wèn)題?@Entity(tableName = "pbInfo_table")data class PbInfo(@PrimaryKey var value: Double, var date: Int, var details: String)interface PbInfoDao { @Query("SELECT * from pbInfo_table") fun getListPbs(): LiveData<List<PbInfo>> @Query("SELECT value, date, details FROM pbInfo_table") fun loadPbInfo(): List<PbInfo> @Insert(onConflict = OnConflictStrategy.REPLACE) fun update(vararg pbInfo: PbInfo): LongArray @Query("DELETE FROM pbInfo_table") suspend fun deleteAll()}D bprivate class PbDatabaseCallback(private val scope: CoroutineScope) : RoomDatabase.Callback() { override fun onOpen(db: SupportSQLiteDatabase) { super.onOpen(db) INSTANCE?.let { database -> scope.launch { populateDatabase(database.pbDao(), database.pbInfoDao()) } } } suspend fun populateDatabase(pbDao: PbDao,pbInfoDao: PbInfoDao) { pbDao.deleteAll() var pb = Pb("Squat") pbDao.insert(pb) var pbInfo = PbInfo(122.5, 28, "I was feeling on top form today!")
房間:警告:從未使用過(guò)參數(shù)/從未使用過(guò)變量
呼喚遠(yuǎn)方
2023-06-04 11:18:34