Using StringSets Amazon DynamoDB Android

0 votes

I have an android application which uses Amazon DynamoDB. My table of users look like this:

@DynamoDBTable(tableName = Const.TEST_TABLE_NAME)
public static class User {
    private int userID;
    private String username;
    private String password;
    private String email;

    @DynamoDBHashKey(attributeName = "userID")
    public int getUserID() {
        return userID;
    }

    public void setUserID(int userID) {
        this.userID = userID;
    }

    @DynamoDBAttribute(attributeName = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @DynamoDBAttribute(attributeName = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @DynamoDBAttribute(attributeName = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}

And everything works fine. My question is, if I have a string set in my table how can I insert it to my code? Using String[] doesn't work( I've tried adding:

    private String[] favourites;

    @DynamoDBAttribute(attributeName = "favourites")
    public String[] getFavourites() {
        return favourites;
    }

    public void setFavourites(String[] favourites) {
        this.favourites = favourites;
    }

) but it keeps throwing errors. Can somebody help me?

Feb 28, 2022 in Others by Edureka
• 13,690 points
417 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
The AWS Mobile SDK for Android simplifies the use of AWS services like Amazon Cognito and Amazon DynamoDB, making it easier for developers to construct mobile apps. Previously, you had to utilise the DynamoDB Object Mapper to get data (or use the service APIs). Then you had to establish a model for DynamoDB in your mobile code that mirrored the model defined in the table. There was additional code to write and test as a result of this. With SDK v2.4.4, we're introducing a new functionality called the Document API. You no longer need to use the DynamoDB Object Mapper with the Document API; instead, you can access specific fields within data objects directly.
answered Mar 2, 2022 by Edureka
• 13,690 points

edited Mar 5

Related Questions In Others

0 votes
1 answer

No Network Security Config specified, using platform default - Android Log

 I had the same problem as which ...READ MORE

answered Feb 18, 2022 in Others by Aditya
• 7,680 points
5,622 views
0 votes
1 answer
0 votes
0 answers
0 votes
0 answers

"unable to locate adb" using Android Studio

While testing my app in a real ...READ MORE

May 1, 2022 in Others by Kichu
• 19,040 points
736 views
0 votes
1 answer

How to prepare an APK for the Amazon Android App Store

you should use zipalign during every build, ...READ MORE

answered Jun 1, 2022 in Others by nisha
• 2,210 points
762 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP