Storing ParseQueryAdapter into String[]{}

58 Views Asked by At

Let's say I have a ParseQueryAdapter, getting titles. I want to store those titles into String[] blah = {}. How can I do that?

Why am I doing this? Because let's say I have a listView, and in that list view I have multiple stuff such as a picture, and 2 textViews. those 2 textViews are coming from Title and Description. So, pretty much I want multiple strings. So it would be the same as:

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

But instead I want:

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

There are 1 best solutions below

6
On BEST ANSWER

Do a regular ParseQuery, and store those objects and a 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;
}