Could you have done result.toMap() instead?
not working i tried
What happened?
i dont know it was not working
maybe you guys can provide proper tutorials on java for android
it says it cannot be cast to model class
What exactly is your code and full error?
i dont have the old code now
above code is working for me
result.toMap() is there but we dont know how can we get each value as string
can you share how to do this result.toMap() method & then get a email value as string
The map is a Map<String, Any> map. You'd have to type check/cast the values like (String) (result.toMap().get("user_email"))
what is any?
<String,String> or <String,Object>
i have known
what is Any ?
told u your methods are complicated
I think Any in kotlin is ? In java. Not sure though. I don't know much about kotlin or java
I blame kotlin and java π
yes exactly you also dont know the solution
thats why i have solved my self above
and this is working
Android/Java/Kotlin is just a pain, but here you go:
Client client = new Client(getApplicationContext())
.setEndpoint("http://10.0.2.2/v1") // Your API Endpoint
.setProject("test"); // Your project ID
Databases databases = new Databases(client);
try {
databases.getDocument(
"default",
"test",
"parent",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Map map = result.getData();
String name = (String) map.get("name");
System.out.println(name);
})
);
} catch (AppwriteException e) {
throw new RuntimeException(e);
}
@Steven thanks
Recommended threads
- 1:1 relationship doesnβt sync after re-a...
Hi, Iβm trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...
- One to many 2 way, console UI not correc...
Hey, seems I'm facing the exactly same issue with this one: https://github.com/appwrite/appwrite/issues/6016 Since this Github issue stay open for so long, let ...