Issue with asynchronous nature of volley calls

Hello, Im having an issue with trying to do two volley calls from to the same api. Okay so basically I am using an api for video games. The first api call retrieves the id of the game based on the search string provided to the api. The second api call takes the id and get alot of info about the game. Here is my code below. Okay so my issue is basically I think because of the asynchronous nature of the volley calls, my recyclerView isnt retrieving all the items that the api is returning. When Im debugging, if I check the size of the arrayList in the parseJson method, its 10 but the recyclerView is only showing 4 items. There is also a weird situation where if I debug and go through each everything step by step then all 10 items do show up in the recyclerView. This is what makes me think my issue is something with the asynchronous volley calls. Is it a good idea to execute volley calls like in the doReviewDownload function recursively? Is there any way to fix this issue with the volley calls conflicting with each other? I have only been using api's for a few months now and this is just a personal project that I thought would be cool to do.
1 Reply
JavaBot
JavaBot12mo ago
This post has been reserved for your question.
Hey @shengzhu4622! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server