Skip to content Skip to sidebar Skip to footer

How To Limit The Display Of Questions In The Quiz Using Json Array In Android?

Hey guys I'm developing a quiz where I have 50 questions stored which are accessed using json array and I want to display only 10 questions, my problem is that all those 50 questio

Solution 1:

From my understanding it would probably be better if you download the entire json response and read only the relevant pieces.

Ideally if you want to have 10 questions and have a total of 50 that means you are going to want to have the 10 occur 5 times. In order to do this, you could just store it all in an ArrayList and then as you get to the next set just offset the position you go to by 10 and then grab those elements and display them and repeat this process until you are out of questions. Or another way would be to remove the top set after each use and just keep reading the top 10 each time.

Keep in mind that as you grab new questions you MUST to update the content with the new elements you are reading the the ArrayList.

Post a Comment for "How To Limit The Display Of Questions In The Quiz Using Json Array In Android?"