Backendless Support
 
Solved

How to update an existing data object in Android?

c2577176c1610924f2b0e5f9c0041a50

This is my Database, no i want to update quoteLikeCount each user click button in andoroid app, i follow example but it's not work and i don't know how to update this row with id.

This is my app

c489320e53ab5b2c57690d6a3ba537bc

Leave a Comment

Comments (4)

photo
1

Pls help me.

photo
1

I can do it, here is the code

  1. private void setLikeAction() {

    btnLike.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View v) {

    HashMap quote = new HashMap();

    quote.put("objectId", quoteId);

    quote.put("quoteLikeCount", likeConut += 1);

    Backendless.Persistence.of(Constants.TABLE_QUOTE).save(quote, new AsyncCallback<Map>() {

    @Override

    public void handleResponse(Map response) {

    btnLike.setImageResource(R.drawable.ic_action_like_on);

    Toast.makeText(getApplicationContext(), R.string.liked, Toast.LENGTH_SHORT).show();

    }

    @Override

    public void handleFault(BackendlessFault fault) {

    Toast.makeText(getApplicationContext(), fault.toString(), Toast.LENGTH_SHORT).show();

    }

    });

    }

    });

    }

photo
1

Hey, sorry for the delay, have you managed to solve the problem by yourself?

photo
1

yes, it very easy

photo