Storing Multitouch points in an array
<p>If I touch my device with my 5 finger tips, my application draws a circle around the touch points. Now, to recognize between my left and right hand I need the values of x,y at each event. </p>

<p>To get that I use </p>

<pre><code>int pointerCount = event.getPointerCount();

for (int i = 0; i &lt; pointerCount; i++)
{
            int id = event.getPointerId(i);
            int x = (int) event.getX(i);
            int y = (int) event.getY(i);
}
</code></pre>

<p>Now to save my x and y values I use two arrays and the above code is modified as given below</p>

<pre><code>private int[] xval,yval; 

 for (int i = 0; i &lt; pointerCount; i++)
    {
            int id = event.getPointerId(i);
            int x = (int) event.getX(i);
            int y = (int) event.getY(i);
            xval[i] = x;
            yval[i] = y;

    }
</code></pre>

<p>The app crashes every time I try saving in an array. Is my approach wrong? Any help will be appreciated. I am new to android so excuse me if it is a silly doubt. I need to save in an array for few calculations used in my code. Nothing works! </p>
