[英]Can't get ParseObject values
Followed the online Parse docs to get the value but Android Studio won't recognize the getInt
method & says - Cannot resolve method 'getInt(java.lang.String)
跟随在线Parse文档获取值,但Android Studio无法识别
getInt
方法并说- Cannot resolve method 'getInt(java.lang.String)
Shouldn't I be able to access the object inside the done callback? 我不应该能够在完成的回调中访问该对象吗? Currently the line is commented out because I can't build the project due to the error?
当前该行已被注释掉,因为由于错误我无法构建项目?
ParseQuery<ParseObject> query = ParseQuery.getQuery("Stats");
query.whereEqualTo("Name", rstr);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> stats, ParseException e) {
if (e == null) {
Log.d("score", "Retrieved " + stats.size() + " scores");
//int score = stats.getInt("errors");
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
You need to fetch the ParseObject
from the stats
variable first, like below 您需要先从
stats
变量中获取ParseObject
,如下所示
ParseObject object = (ParseObject) stats.get(position);
int score = object.getInt("errors");
stats
is not a ParseObject
, it's a List<ParseObject>
. stats
不是ParseObject
,而是List<ParseObject>
。 You need to get the objects out of the list. 您需要将对象从列表中删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.