Array index out of bounds exception android
<p>I am trying to get the data from database table via php file and displaying it in android. In php file I seperated each column with "#".
So now I am getting values like 4#2012-11-06#test1#test2. But for some columns there is not data. So the values are comng like 5###.
Here when I splitting with # and displaying the data it is throwing out of bounds exception. How can I resolve this issue?</p>

<p>Code:</p>

<pre><code>String st="1#2012-10-30#test1@2#2012-10-30#test2@3#2012-11-06#test3@9##test1@21##@22##@23##@";
    String[] val = st.trim().split("@");

for (int i = 0; i &lt; val.length; i++)
        {
            String str = val[i];

            String arr[] = str.split("#");
                  System.out.println("arr0" + arr[0]);
            System.out.println("arr1" + arr[1]);
            System.out.println("arr2" + arr[2]);
}
</code></pre>
