ArrayList to Array of Strings in java
<pre><code>ArrayList&lt;String&gt; newArray = new ArrayList&lt;String&gt;();
    newArray = urlList.getUrl();
    for( int i = 0 ; i &lt; newArray.size();i++)
    {
        System.out.println(newArray.get(i));
    }

    newArray.toArray(mStrings );// is this correct 
    mStrings = newArray.toArray();//  or this to convert ArrayList ot String array here

    for( int i = 0 ; i &lt; mStrings.length;i++)
    {
        System.out.println(mStrings[i]);
    }



edit: when i try as below , i get null pointer exception

try
        {
                newArray.toArray(mStrings );
                for( int i = 0 ; i &lt; mStrings.length;i++)
                {
                    System.out.println(mStrings[i]);
                }
        }catch( NullPointerException e )
        {
            System.out.println(e);
        }
</code></pre>
