title: Add string to array and return array list
body: <p>I want to add string s to list array and return list after added s to add to arrayadapter to display in listview.       </p>
  
  <pre class="lang-java prettyprint-override"><code> ArrayList&lt;String&gt; arraylist;
   for (int i = 0; i &lt; friendsData.length(); i++) 
   {
     JSONObject friend = friendsData.getJSONObject(i);
     String s=friend.getString("name");
     arraylist.add(s);
   }
   ArrayAdapter&lt;String&gt; adapter=new  ArrayAdapter(myactivity.this,android.R.layout.simple_list_item1,arraylist);
   listview.setAdapter(adapter);
  </code></pre>
  
  <p>But listview not display item and error null poiter.Help me.</p>