Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:03:08+00:00 2026-06-10T17:03:08+00:00

I just started using the Android SDK for AWS SDB, and am encountering an

  • 0

I just started using the Android SDK for AWS SDB, and am encountering an unexpected result doing writes and reads. This is surely a simple problem, so I would appreciate any explanations!

Here’s the problem.

First, I write a record to SDB like this:

sdb.createDomain(new CreateDomainRequest("myDomain"));

List<ReplaceableAttribute> attributes = new ArrayList<ReplaceableAttribute>(1);
attributes.add(new ReplaceableAttribute().withName("myField").withValue(myField));

sdb.putAttributes(new PutAttributesRequest("myDomain", itemName, attributes));

I can see the value of myField is correctly written to SDB using the Chrome SdbNavigator.

Now I change the record using the same code, but with a different value for the myField attribute. Again, I can see that the record is written correctly with the new value using SdbNavigator.

Finally, I uninstall the app from the device (i.e., wipe it clean), reinstall the app, and run it again to execute the following code:

String s = "select * from `myDomain`";
SelectRequest selectRequest = new SelectRequest(s).withConsistentRead(true);
List items = sdb.select(selectRequest).getItems();

int count = items.size();

for (int i=0; i<count; i++) {
    Item item = (Item)(items.get(i));
    String itemName = item.getName();

    myField = getStringValueForAttributeFromList("myField", item.getAttributes());
}

where getStringValueForAttributeFromList() is defined as

protected String getStringValueForAttributeFromList( String attributeName, List<Attribute> attributes ) {
    for ( Attribute attribute : attributes ) {
        if ( attribute.getName().equals( attributeName ) ) {
            return attribute.getValue();
        }
    }
    return "";      
}

The unexpected part is that the getStringValueForAttributeFromList() function returns the first (now incorrect) value of the myField attribute – even though the sdbNavigator shows the record has the second (correct) value.

Any idea what is happening, and how to fix?? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:03:10+00:00Added an answer on June 10, 2026 at 5:03 pm

    SOLVED: The issue I was facing is that SDB allows multiple attributes with the same name in the same record (item), so it was picking up the first value I set for the attribute myField.

    If you want to guarantee uniqueness, you have to set a flag on the replaceable attribute as follows:

    ReplaceableAttribute ra = new ReplaceableAttribute().withName("myField").withValue(myField);
    ra.setReplace(true); attributes.add(ra);
    

    and then call putAttributesRequest(), as above. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started with Android programming using eclipse and recently came across this problem.
I have just started using android, and have about 5 layout files finished. However,
Just started using Java (for Android, if that matters) and all I want is
I have just started learning to write apps for android using Eclipse. Where can
I am new to android.. just started writing service using activity.. i want to
Hey. I just started with Android. I'm using the ViewFlipper layout with 2 LinearLayouts.
i am using the facebook android sdk, which i just downloaded from github. i
I just recently started using Mono for Android and I am trying to consume
I recently started using android actionbars and contextual action bars (CAB). I have just
I've just started using DOM and wanted to parse an Android XML layout file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.