I am attempting to write an app for my D&D group, and one of the functions will be to store the groups character stats, which i will display in the app.
I went to the following tutorials and documents to try and learn about how to do it, https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin/#0 https://developer.android.com/training/data-storage/room/defining-data.html https://developer.android.com/guide/topics/data/data-storage I got the basics, and created a new kotlin file within my project to define the entity, Dao etc, and will post my code how far i have got, however have reached a dead end of my understanding in trying to get it to work. I am trying to do something as minimal as possible and get that working, and then expand it to store the other character stats.
stats.kt
package com.taylorworld.tw01
import androidx.lifecycle.LiveData
import androidx.room.*
@entity (tablename = "stat_table")
data class Stats(
@ColumnInfo(name = "stat") val stat: string,
@PrimaryKey val num: Int)
)
@Dao
interface StatDao {
@Query("SELECT stat from stat_table")
fun getStats(): LiveData<<List<Stats>
@Insert
suspend fun insert(stat: Stats)
}
@Abstract val statDao: StatDao{}
when i try and compile the project, i get the following error messages. https://imagebin.ca/v/4h9cpZurjoA2