3

I'm trying to retrieve an entire array that is stored in parse. I know how to retrieve int, strings but I dont know how to retrieve an array. I've used .get() but i dont know how to do it. Do I have to create an ArrayList? A List ?

//Inside the query
ArrayList<String> list= new ArrayList<String>;
list=object.get("array");

If you can provide an example please.

3 Answers 3

4

You could use:

list.addAll(object.getList("array"));

The API Reference provided by Parse is very useful.

Sign up to request clarification or add additional context in comments.

Comments

1

That's exactly what getJSONArray() is for.

For example:

 ArrayList<String> list= new ArrayList<String>;
 list=object.getJSONArray("arrayName");

DOCS

3 Comments

RTFM is not an answer I want to see. en.wikipedia.org/wiki/RTFM Please use an example if possible and I will remove downvote.
Okay I added an example. Thanks for keeping me in line! SO is better for it.
Ok, I can't assign a JSONArray to an arraylist... this doesn't compile.
0

I used the following code:

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

// In ParseQuery //
list = (ArrayList<String>)object.get("ColumnName");

I hope this helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.