Admin
Could you have done result.toMap() instead?
Votes
0
Replies
24
Participants
Unknown
Messages
25
Admin
Could you have done result.toMap() instead?
Rank 2: Process
not working i tried
Admin
What happened?
Rank 2: Process
i dont know it was not working
Rank 2: Process
maybe you guys can provide proper tutorials on java for android
Rank 2: Process
it says it cannot be cast to model class
Admin
What exactly is your code and full error?
Rank 2: Process
i dont have the old code now
Rank 2: Process
above code is working for me
Rank 2: Process
result.toMap() is there but we dont know how can we get each value as string
Rank 2: Process
can you share how to do this result.toMap() method & then get a email value as string
Admin
The map is a Map<String, Any> map. You'd have to type check/cast the values like (String) (result.toMap().get("user_email"))
Rank 2: Process
what is any?
Rank 2: Process
<String,String> or <String,Object>
Rank 2: Process
i have known
Rank 2: Process
what is Any ?
Rank 2: Process
told u your methods are complicated
Admin
I think Any in kotlin is ? In java. Not sure though. I don't know much about kotlin or java
Admin
I blame kotlin and java 😜
Rank 2: Process
yes exactly you also dont know the solution
Rank 2: Process
thats why i have solved my self above
Rank 2: Process
and this is working
Admin
Android/Java/Kotlin is just a pain, but here you go:
Admin
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); }Rank 2: Process
@Steven thanks