gpt4 book ai didi

java - Parse.com 获取查询并将其转换为字符串 Java

转载 作者:行者123 更新时间:2023-11-30 02:53:52 25 4
gpt4 key购买 nike

我想做的是查询一个类并获取一些字符串。但是下面的代码返回类似 ;

com.parse.ParseObject@b4209180

而且我无法将其设置为正常的字符串值。

ParseQuery<ParseObject> query = ParseQuery.getQuery("question");
//query.whereKeyExists:@"objectId"
query.whereExists("questionTopic");

query.findInBackground(new FindCallback<ParseObject>() {

@Override
public void done(List<ParseObject> topics, ParseException e) {
// TODO Auto-generated method stub
if(e==null){


textview.setText(topics.toString());

}


}else{
Log.d("notretreive", "Error: " + e.getMessage());
}


}
});

最佳答案

代码中的“主题”是问题对象的列表。您需要从该对象中获取主题。这应该让你上路:

ParseQuery<ParseObject> query = ParseQuery.getQuery("question");
query.whereExists("questionTopic");

query.findInBackground(new FindCallback<ParseObject>() {

@Override
public void done(List<ParseObject> questions, ParseException e) {
// The query returns a list of objects from the "questions" class
if(e==null){
for (ParseObject question : questions) {
// Get the questionTopic value from the question object
Log.d("question", "Topic: " + question.getString("questionTopic");
}
} else {
Log.d("notretreive", "Error: " + e.getMessage());
}
}
});

关于java - Parse.com 获取查询并将其转换为字符串 Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23668136/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com