title: How to display random items from arraylist<T> derived from a doInBackground?
body: <p>So i was making this app which displays an arrayList of different poems 
  I first request the poems from API then the Asynctask returns the poems in the form of Arraylist i wand to show 20 random poems from the list.</p>
  
  <p>This is the Asynctask code</p>
  
  <pre><code>private class TitleAsynctask extends AsyncTask&lt;URL,Void,List&lt;view&gt;&gt; {
  
  
          private ProgressDialog progressDialog;
          @Override
          public List&lt;view&gt; doInBackground(URL... urls){
  
              URL url = Query_utils.createurl(POEM_TITLE);
              String json = "";
              Log.d(LOG_TAG,"this worked");
              {
                  try {
                      json = Query_utils.makehttprequest(url);
                      Log.d(LOG_TAG, "make Httprequest works");
                  } catch (IOException e) {
  
                  }
              }
              List&lt;view&gt; title_view = Query_utils.extracttitlefromjson(json);
              return title_view;
  
          }
  
          @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
          @Override
          protected void onPostExecute(List&lt;view&gt; data) {
              madapter.clear();
  
  
              if (data != null &amp;&amp; !data.isEmpty()){
                  madapter.addAll(data);
              }
          }
  
      }
  </code></pre>
  
  <p>and the onCreate code is </p>
  
  <pre><code> TitleAsynctask task = new TitleAsynctask();
      URL url = Query_utils.createurl(POEM_TITLE);
              task.execute(url);
  
  
              ArrayList&lt;view &gt; arr = new ArrayList&lt;view&gt;();
  
              final ListView poem_Title_list = (ListView) findViewById(R.id.list_item);
              madapter = new title_adapter(this ,arr);
              poem_Title_list.setAdapter(madapter);
  </code></pre>