This is my code to fetch data for a particular Attribute-
try {
lifecycleScope.launch {
val getData = databases.getDocument(
databaseId = "669...49",
collectionId = "669...15d6",
documentId = "669...2f5b",
queries = listOf(Query.select(listOf("PrescriptionFileId")))
)
Log.d("GetFilesLog", "Result: ${getData}")
}
catch (e : Exception){
Log.d("GetFilesLog", "Exception: $e")
}```
Here is the Exception -
FATAL EXCEPTION: OkHttp Dispatcher (Ask Gemini) Process: com.geekster.getfilesfromdevice, PID: 29680 java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String at io.appwrite.models.Document$Companion.from(Document.kt:89) at io.appwrite.services.Databases$getDocument$converter$1.invoke(Databases.kt:190) at io.appwrite.services.Databases$getDocument$converter$1.invoke(Databases.kt:188) at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:541) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:545) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)```
Even though I'm finally able to get the required data from the Attribute by getting the response without the query and converting the response to Json and then to Gson and then getting the required data. But I wanted to know is there any issue with my codebase or the query isn't working for Android SDK. I've tried using other queries, few of them work as expected but other ones throw some errors.
Recommended threads
- Android Realtime access
Im working on an Android app which requires realtime chatting also, but seems like there is no way to listen to realtime data based on queries. Like listening...
- Upload images in android studio using ko...
I am able to connecting appwrite but I m unable to upload videos and images on the server . Basically I m working on instagram clone app and I need a data base ...
- Query.select doesn’t works
Im trying to use Query.select and Query.equal queries in Appwrite Android SDK v 3.0.0 But getting nullpointer exception I also tried adding systemAttributes ma...