Sebastian Delgado
Sebastian Delgado

Reputation: 725

How to save this to parse.com data base?

i'm making an android app that has a login made with the parse.com library, it works all right and it leads you to another activity that contains 4 fragments (scrollable tabs), one of those fragments has a button that displays a dialog fragment that allows the user to enter 2 strings.

How can i save those 2 strings to the parse data base, but "linked" to the account where the strings where added?

The idea is to take those strings and display them in fragment where the button is located, and as the strings are "linked" with the account if the user logs in in another device, the strings would be still there.

Thanks very much for reading.

Upvotes: 0

Views: 92

Answers (1)

Tushar Gogna
Tushar Gogna

Reputation: 5083

This is as straightforward as it can get.

Example via Parse.com Docs:

ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.saveInBackground();

In this, "GameScore" is the Table name, "score", "playerName" & "cheatMode" are the Column name.

So for adding two string values (suppose 'Cost' & 'Type') in a table (suppose 'Cars'), you do this:

 ParseObject car= new ParseObject("Cars");
    car.put("Cost", "$6,000");
    car.put("Type", "4 Wheel Drive");
    car.saveInBackground();

For Detailed Explanation Click here.

Upvotes: 2

Related Questions