
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
- Push notification by "users" or by "targ...
*Android, messaging using FCM, self-hosted 1.6.1, Python backend* Hey, I thought that by just setting the users = [<user_id>] inside the create_push() function...
- .Net MAUI and appwrite ..not able to rea...
Hi All , I am new to .NET MAUI and appwrite , seems I have a road block ..my code goes like client = new Client() .SetEndpoint(_settings.Appwrit...
- Help me to choose best BAAS for my datin...
Hey everyone! 👋 I'm building a dating app using Kotlin for Android, and I'm planning to use Appwrite as the backend. I want to know if Appwrite is a good choic...
