Skip to content Skip to sidebar Skip to footer

Add New Row In Parse Class Using Android

Can't create a new row in using Parse in android. I am able to retrieve, but when I try to add a new row like this, I keep getting false and new row is not being created. What am

Solution 1:

Check class level permission Write under class StoryActivity's Security on console.


Solution 2:

Call that in following way -

ParseObject storyActivity = new ParseObject("StoryActivity");
storyActivity.put("createdByUser", user);
storyActivity.put("story", story);
storyActivity.put("type", likeUnlike);
 storyActivity.saveInBackground(new SaveCallback() {
   public void done(ParseException e) {
     if (e == null) {
       // your object is successfully created.
     } else {
       //error occurred
       Toast.makeText( context,e.getMessage().toString(),Toast.LENGTH_LONG );
     }
   }
 });

So, by this toast message you can know what is reason of problem you are getting.


Solution 3:

Try on this way to set read write permission when user insert/ update record in parse database like ...

ParseObject storyActivity = new ParseObject("StoryActivity");
    storyActivity.put("createdByUser", user);
    storyActivity.put("story", story);
    storyActivity.put("type", likeUnlike);

    // here first set read write permission like ..
    // when user update value ya insert new value in database
    ParseACL postACL = new ParseACL(ParseUser.getCurrentUser());
    postACL.setPublicReadAccess(true);
    postACL.setPublicWriteAccess(true);
    storyActivity.setACL(postACL);

    storyActivity.saveInBackground(new SaveCallback() {

        @Override
        public void done(ParseException e) {
            // TODO Auto-generated method stub
            if (e == null) {
                // success
            } else {
                // fail
                Log.e("Tag", "getting to fail " + e.getMessage());
            }
        }
    });

Post a Comment for "Add New Row In Parse Class Using Android"