** It's written using a program of translator. **
https://aws.amazon.com/getting-started/hands-on/build-android-app-amplify/module-four/?nc1=h_ls
I coded as above.
In the case of create, it was performed normally, and it was possible to check the data in DynamoDB in the AWS account. However, in the case of read, an error message of "Validation error of type FieldUndefined: Field 'listNoteDatas' in type 'Query' is undefined @ 'listNoteDatas'' is returned.
Amplify.API.query(
ModelQuery.list(NoteData::class.java),
{ response ->
Log.i(TAG, "Queried 1")
for (noteData in response.data) {
Log.i(TAG, noteData.name)
UserData.addNote(UserData.Note.from(noteData))
}
},
{ error -> Log.e(TAG, "Query failure", error) }
)
By designating the id with the get function instead of the list, it was performed normally when reading.
Amplify.API.query(
ModelQuery.get(NoteData::class.java, "id value checked in DynamoDB"),
{ response ->
Log.i(TAG, "Queried 2")
if (response.data != null){
UserData.addNote(UserData.Note.from(response.data))
} else {
Log.e(TAG, "response.data != null")
}
},
{ error -> Log.e(TAG, "Query failure", error) }
)
How to run ModelQuery.list normally?
** It's written using a program of translator. **


