1

Im having the following objects in my class,

LatestRingtones latestRingtones;
MostDownloadedSongs mostDownloadedSongs;
LatestDialoges latestDialoges;

LatestRingtones, MostDownloadedSongs,LatestDialoges extends sugarrecord.

So, I have created an arraylist to store object of various types as follows,

public List<SugarRecord> streamingTrackList = new ArrayList<>();

I tried to add the latestRingtones as follows

streamingTrackList.add(latestRingtones);

but im getting an error like List can not be applied to jsonarray

How can i be able to convert the jsonarray to list and add it to streaming track or is there any ways through which I can add object of various types to streamingTrack?

7
  • How are you getting this latestDialogeTen? Is it a list or object? More code will be helpful to understand your situation. Commented Sep 17, 2016 at 8:07
  • What is the actual type of latestDialogeTen? How is it declared? How is it obtained? Commented Sep 17, 2016 at 8:17
  • Why are you trying to store a random assortment of things in one array? Commented Sep 17, 2016 at 8:34
  • 2
    For a question about code not working we need a Short, Self Contained, Correct (Compilable), Example (maybe not always, but I should say we do in this case). You may think it’s much work at first, but in the end I believe you’ll find it worthwhile. Commented Sep 17, 2016 at 8:41
  • 1
    You're asking a question about an error message you don't understand, related to some code. So, your question should contain the code causing the error, and the exact and complete error message you got. Commented Sep 17, 2016 at 8:44

1 Answer 1

1

If latestRingtones is a json array you can not add a JsonArray into ArrayList . So simply convert you jsonarray in Object array using any know library (gson , simple json etc) and than add the objects into your ArrayList

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

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.