title: How to use onSaveInstanceState method with Arraylist
body: <p>I have built an ArrayList with an API results. I don`t want it to disappear when a user rotates his phone. </p>
  
  <p>What should I do with onSaveInstanceState? </p>
  
  <pre><code>JSONObject json = new JSONObject(result);
  
                      JSONArray searchArray = json.getJSONArray("Search");
  
                      for (int i = 0; i &lt; searchArray.length(); i++) {
                          JSONObject searchObject = searchArray.getJSONObject(i);
                          String title = searchObject.getString("Title");
                          String type = searchObject.getString("Type");
                          String year = searchObject.getString("Year");
                          String imdbID = searchObject.getString("imdbID");
  
                          movieList.add(new Movie(title, type, year, imdbID));
  </code></pre>