I have a problem with updating values per row in a cloud storage site called parse.com. I am only a newbie in using parse.com. I have read the documentation about it and have understand it. But what I want to do is a little bit different from the example there. Here's my code..
public void onClick(View arg0) {
if (arg0.getId() == R.id.button1) {
ParseQuery query = new ParseQuery("inventory");
query.findInBackground(new FindCallback() {
public void done(List<ParseObject> test, ParseException e) {
ParseObject testObject = new ParseObject("inventory");
if(e==null) {
String str="";
String str2="";
for(int x =0;x<test.size();x++){
str = test.get(x).getString("name");
str2 = test.get(x).getString("quantity");
if (!str.equals(et1.getText().toString())){
str = "";
}
if(str.equals(et1.getText().toString()))
{
testObject.put("quantity", et2.getText().toString());
testObject.saveInBackground();
x = test.size();
}
else{
tv1.setText("error" + e.getMessage());
}
}
}}
});
} }
I want to update the quantity of the product name that i have inputted. when my input is equal to the name on the cloud it will update the other column which refers to the product name that I have inputted. But as a result of my code, it creates a new row, instead of updating the existing row.. what is lacking/wrong in my code? can someone please help me? :) thanks in advance! :)