I have saved local contacts into the database and that database has 2000 rows. I am using the select query to select all contacts but it takes 6 to 8 secs to get a list
@Query("SELECT * FROM Contacts")
fun getLiveLocalContactList(): LiveData<List<LocalContactsUserEntity>>
Here is Entity
@Entity(tableName = "Contacts")
data class LocalContactsUserEntity(
@PrimaryKey(autoGenerate = false)
val mobileNumber: String,
var name: String
){
override fun toString(): String {
return Gson().toJson(this)
}
}
Is there any solution or am I doing something wrong?
Update For This Question
I have checked That Database Returns Data As Soon as But It is RecyclerView that takes time to load data. How to set huge dataset to RecyclerView Like ContactList in our app.