title: Adding value to String[] android
body: <p>I want to have an example <code>String[] images</code> like the below dynamically, but i cannot achieve it</p>
  
  <pre><code>String[] images = new String[] { "http://image/image1", "http://image/image1", "http://image/image1"};
  </code></pre>
  
  <p>I have a json where it contains the image urls, below code is how i am tryig to put the json image urls to the <code>string[] images</code></p>
  
  <pre><code> String[] images = new String[]{};
  
   for (int i = 0; i &lt; contacts.length(); i++) {
       JSONObject c = contacts.getJSONObject(i);
  
       String imagepath = c.getString("imagepath");
  
       images[i] = imagepath; // trying to put the values to String[] images
       }
  </code></pre>