将ParseQueryAdapter存储到String [] {}中

时间:2015-12-10 18:32:42

标签: android parse-platform android-parsequeryadapter

让我说我有ParseQueryAdapter,获得头衔。我想将这些标题存储到String[] blah = {}。我怎么能这样做?

为什么我这样做?因为我们说我有listView,并且在该列表视图中我有多个内容,例如图片和2个textViews。这2个textView来自标题和描述。所以,我几乎想要多个字符串。所以它将是:

String[] blah = {
"blah1"
"blah2"
"blah3"
}

但我想要:

String[] blah = {
ParseQueryAdapter<ParseObject> query = new 
ParseQueryAdapter(this,"Class");
query.setTextKey("title");
    }

1 个答案:

答案 0 :(得分:1)

定期ParseQuery,并存储这些对象和List<String>

List<String> myObjects = new ArrayList<>();

public void runQuery() {
    ParseQuery<ParseObject> query = ParseQuery.getQuery("BarbecueSauce");
    query.whereStartsWith("name", "Big Daddy's");
    query.findInBackground(new FindCallback<ParseObject>() {
          @Override
          public void done(List<ParseObject> objects, ParseException e) {
             if(e == null){
               for(ParseObject o : objects){
                 myObjects.add(o.toString());
               }
             } else {
               Log.e(TAG, "Error: " + e.getMessage);
             }
         }
   }
}

public List<String> getObjects(){
   return myObjects;
}