Thing I was doing kind of wrong:
-Not including my sort (a.k.a. Range) key in my object to be send for the update.
For the rest:
First, get your DynamoDBClient, I'd strongly suggest implementing a singleton pattern for calling this, I used the configuration.json in this case:
AWSMobileClient.getInstance().initialize(NewPatientActivity.this).execute();
AWSCredentialsProvider credentialsProvider = AWSMobileClient.getInstance().getCredentialsProvider();
AWSConfiguration configuration = AWSMobileClient.getInstance().getConfiguration();
// Add code to instantiate a AmazonDynamoDBClient
AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient(credentialsProvider);
Then set an UpdateItemRequest like this:
//SET THE KEYS VALUES
HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
key.put("your-partition-key", new AttributeValue().withS(value));
key.put("your-sort-key-if-exists", new AttributeValue().withS(value));
//SET VALUES TO REPLACE OLD ONES
Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
expressionAttributeValues.put(":val1",new AttributeValue().withN(value1));
expressionAttributeValues.put(":val2", new AttributeValue().withS(value2));
/*
IF YOU WANT TO READ THE JUST-UPDATED ITEM, HAVE THIS READY
ReturnValue returnValues = ReturnValue.ALL_NEW;
*/
//SET THE UPDATEITEMREQUEST
UpdateItemRequest updateItemRequest = new UpdateItemRequest()
.withTableName("your-table-name")
//KEYS DEFINED ABOVE
.withKey(key)
//SET WHERE TO UPDATE
.withUpdateExpression("set attr1 = :val1, attr2 = :val2")
.withExpressionAttributeValues(expressionAttributeValues)
//INDICATE TO RETURN UPDATED ITEM
.withReturnValues(returnValues);
//GET THE RESULT OF YOUR UPDATE AND EXECUTE IT
UpdateItemResult result = your-dynamo-client.updateItem(updateItemRequest);
//convert it to a string
Gson gson = new Gson();
String x = gson.toJson(result);
//Check it out
Log.e("RESULT :",x);
For further information, I elaborated this gist.