Reputation: 4365
Here is my code:
package com.alibdeir.database;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.parse.GetCallback;
import com.parse.Parse;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.SaveCallback;
import com.parse.ParseException;
public class MainActivity extends AppCompatActivity {
TextView output;
Button increase;
int currentInt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Parse.initialize(this, "QeaC0wiXsL9MyRbLaQ***********", "kDjoZVRu4OyWOGxPtPjh**************");
output = (TextView) findViewById(R.id.output);
increase = (Button) findViewById(R.id.increase);
ParseQuery query = new ParseQuery("int");
ParseObject o = query.get-("n6zA3CHxGx");
}
public void increase(View v) {
currentInt = Integer.parseInt(output.getText().toString());
output.setText(currentInt + 1 + "");
}
}
Notice: ParseQuery query = new ParseQuery("int"); ParseObject o = query.get("n6zA3CHxGx");
On hover of query.get("n6zA3CHxGx"); i have the error mentioned in the title. I am trying to update an object that's in the parse cloud. The object IS in the cloud. Please help
Upvotes: 0
Views: 550
Reputation: 25312
Trying your code with handle exception using try { .. } catch
like this.
try {
Parse.initialize(this, "QeaC0wiXsL9MyRbLaQ***********", "kDjoZVRu4OyWOGxPtPjh**************");
output = (TextView) findViewById(R.id.output);
increase = (Button) findViewById(R.id.increase);
ParseQuery query = new ParseQuery("int");
ParseObject o = query.get-("n6zA3CHxGx");
} catch (com.parse.ParseException e1) {
e1.printStackTrace();
}
As per this Parse forum discussion ACL settings are the default are public read, owner-write. You can change those to allow writes by other users.
By using below code:-
ParseACL postACL = new ParseACL(ParseUser.getCurrentUser());
postACL.setPublicReadAccess(true);
postACL.setPublicWriteAccess(true);
Upvotes: 0