title: How do i match the key from api with another key from the same api, under same object?
body: <p>I am building an android app quiz, i am learning how to get data from API and display it. 
  So far, i am doing good. But i can't seems to get further. 
  The free api i am using is this</p>
  
  <pre><code>https://www.opentdb.com/api.php?amount=10&amp;category=10
  </code></pre>
  
  <p>My problem is i can't seems to match the question and the correct answer from the object. I always get random question and random correct answer on button click</p>
  
  <p>This is my code</p>
  
  <pre><code>    //url =  https://www.opentdb.com/api.php?amount=25
       public class MainActivity extends AppCompatActivity {
  
  
  private TextView textData;
  private TextView answer;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Button btn = (Button) findViewById(R.id.btnId);
      textData = (TextView) findViewById(R.id.txtV);
      answer = (TextView) findViewById(R.id.answerCorrect);
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              //executing the AsyncTask on button click
              new JSONTask().execute("https://www.opentdb.com/api.php?amount=10&amp;category=10&amp;difficulty=easy&amp;type=multiple");
          }
      });
  
  
  }
  class JSONTask extends AsyncTask&lt;String, String, String&gt; {
  
  
      @Override
      protected String doInBackground(String... params) {
  
          HttpURLConnection connection = null;
          StringBuffer stringBuffer;
          BufferedReader bufferedReader = null;
          try {
  
              //passing url here
  
              URL url = new URL(params[0]);
              //making a connection
              connection = (HttpURLConnection) url.openConnection();
              //connecting to the server
              connection.connect();
  
              //getting object from server and storing to inputStream
              InputStream stream = connection.getInputStream();
  
              //buffer reader to read the data from inputstream
              bufferedReader = new BufferedReader(new InputStreamReader(stream));
              //holding data
              stringBuffer = new StringBuffer();
  
              String line = "";
              while ((line = bufferedReader.readLine()) != null) {
  
                  stringBuffer.append(line);
  
              }
              //toString will be passed to the onPostExecute result value
              //return completed JSON object
              String finalOBJ = stringBuffer.toString();
              //passing entire json object in new JSON object instance.
              JSONObject  jsonObject = new JSONObject(finalOBJ);
              //getting the array from the main  object
              JSONArray jsonArray = jsonObject.getJSONArray("results");
              //passing the desired index from the results
              JSONObject fobj = jsonArray.getJSONObject(3);
              JSONObject ansobj = jsonArray.getJSONObject(4);
              //getting the key from results array
              String question = fobj.getString("question");
  
              return question;
          } catch (IOException | JSONException e) {
              e.printStackTrace();
          } finally {
              if (connection != null) {
                  connection.disconnect();
              }
              try {
                  if (bufferedReader != null) {
                      bufferedReader.close();
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
  
          }
          return null;
      }
  
      @Override
      //here result will take the data
      protected void onPostExecute(String result) {
          super.onPostExecute(result);
          textData.setText(result);
      }
  }
  </code></pre>
  
  <p>JSON APi i am taking from that site.</p>
  
  <p>What i want to achieve is the show the question with the correct answer from same object.
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{
     "response_code":0,
     "results":[
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"easy",
           "question":"George Orwell wrote this book, which is often considered a statement on government oversight.",
           "correct_answer":"1984",
           "incorrect_answers":[
              "The Old Man and the Sea",
              "Catcher and the Rye",
              "To Kill a Mockingbird"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"Which author and poet famously wrote the line, &amp;quot;The female of the species is more deadly than the male&amp;quot;?",
           "correct_answer":"Rudyard Kipling",
           "incorrect_answers":[
              "Edgar Allan Poe",
              "William Shakespeare",
              "William Wordsworth"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"In the book &amp;quot;The Martian&amp;quot;, how long was Mark Watney trapped on Mars (in Sols)?",
           "correct_answer":"549 Days",
           "incorrect_answers":[
              "765 Days",
              "401 Days",
              "324 Days"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"In the Harry Potter universe, what is Cornelius Fudge&amp;#039;s middle name?",
           "correct_answer":"Oswald",
           "incorrect_answers":[
              "James",
              "Harold",
              "Christopher"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"In the Harry Potter universe, who does Draco Malfoy end up marrying?",
           "correct_answer":"Astoria Greengrass",
           "incorrect_answers":[
              "Pansy Parkinson",
              "Millicent Bulstrode",
              "Hermione Granger"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"What is Hermione Granger&amp;#039;s middle name?",
           "correct_answer":"Jean",
           "incorrect_answers":[
              "Jane",
              "Emma",
              "Jo"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"hard",
           "question":"What is Ron Weasley&amp;#039;s middle name?",
           "correct_answer":"Bilius",
           "incorrect_answers":[
              "Arthur",
              "John",
              "Dominic"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"medium",
           "question":"What was the name of the Mysterious Island, in Jules Verne&amp;#039;s &amp;quot;The Mysterious Island&amp;quot;?",
           "correct_answer":"Lincoln Island",
           "incorrect_answers":[
              "Vulcania Island",
              "Prometheus Island",
              "Neptune Island"
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"easy",
           "question":"What&amp;#039;s Harry Potter&amp;#039;s dad&amp;#039;s name?",
           "correct_answer":"James Potter",
           "incorrect_answers":[
              "Joey Potter",
              "Frank Potter",
              "Hairy Potter Sr."
           ]
        },
        {
           "category":"Entertainment: Books",
           "type":"multiple",
           "difficulty":"medium",
           "question":"The book &amp;quot;The Little Prince&amp;quot; was written by...",
           "correct_answer":"Antoine de Saint-Exup&amp;eacute;ry",
           "incorrect_answers":[
              "Miguel de Cervantes Saavedra",
              "Jane Austen",
              "F. Scott Fitzgerald"
           ]
        }
     ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>}</p>