未处理的异常:com.parse.parseException android studio [英] Unhandled exception: com.parse.parseException android studio
本文介绍了未处理的异常:com.parse.parseException android studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
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 + "");
}
}
注意:ParseQuery 查询 = new ParseQuery("int");ParseObject o = query.get("n6zA3CHxGx");
Notice: ParseQuery query = new ParseQuery("int"); ParseObject o = query.get("n6zA3CHxGx");
悬停在 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
推荐答案
像这样使用
try { .. } catch
尝试处理异常的代码.
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();
}
根据 this 解析论坛讨论ACL 设置默认是公共读取,所有者写入.您可以更改这些以允许其他用户写入.
通过使用以下代码:-
ParseACL postACL = new ParseACL(ParseUser.getCurrentUser());
postACL.setPublicReadAccess(true);
postACL.setPublicWriteAccess(true);
这篇关于未处理的异常:com.parse.parseException android studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文