简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM