[英]Getting a ParseUser from a List<ParseUser> using Parse SDK for android?
使用Android的Parse SDK,我嘗試從查詢中接收ParseUser,以下代碼是我嘗試過的:
ParseQuery<ParseUser> query = ParseUser.getQuery();
Follow.include("author");
query.whereEqualTo("User", "Alex");
query.findInBackground(new FindCallback<ParseUser>() {
public void done(List<ParseUser> objects, ParseException e) {
if (e == null) {
// This is where I want to receive the ParseUser from the List<ParseUser>
ParseUser pu = objects.get("author");
} else {
}
} });
Object.get(“ author”)創建錯誤。
謝謝您的閱讀:)
ParseUser pu = objects.get("author"); would be incorrect usage. Get method is generally used to get a object at a particular position in the list.
該查詢返回您已命名為對象的ParseUsers的列表。 現在使用迭代器瀏覽列表以訪問每個ParseUser。
像這樣
for(ParseUser pu : objects){
//access the data associated with the ParseUser using the get method
//pu.getString("key") or pu.get("key")
}
希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.