Reputation: 123
I have 3 edit-texts in my activity (Name, mobile number, occupation) and a button (Save). I want to save these three data to Parse-cloud every-time when user clicks on the button. Then new activity to display with a image in imageview that should be saved with the corresponding mobile number.
Upvotes: 1
Views: 4260
Reputation: 2633
Saving data to parse is very simple. In your button click handler you just need to get the 3 values that you are interested in then create the new parse object;
String name = nameEditText.getText().toString();
String mobileNumber = mobileNumberEditText.getText().toString();
String occupation = occupationEditText.getText().toString();
ParseObject dataObject = new ParseObject();
dataObject.put("name", name);
dataObject.put("mobilenumber", mobileNumber);
dataObject.put("occupation", occupation);
dataObject.saveInBackground();
Somewhere in your app you will need to remember to set your application id and key as supplied to you by Parse. I tend to do it in an Application
object in the onCreate
method;
public void onCreate() {
Parse.initialize(this, "Your Application Id", "Your Client Key");
}
The Parse Object API is very simple to work with I tend to find as there isn't too much to get your head around. If you are completely new to Parse and you haven't already then I would recommend taking a look at their quickstart.
Upvotes: 7