MotionEvent.ACTION_MOVE is too fast and not getting correct X & Y Coordinates
<p>i am using Action_Move &amp; Action_Down</p>

<p>for getting x &amp; y in my app so i can check either my canvas drawed line is crossed / Touch but Action_Move is getting x &amp; y coordinates too fast when my code run all for loop its get another x &amp; y coordinate and code run all over again</p>

<p>Its working fine in Action_Down because that will be touched after break of time so my code get time to do all work</p>

<p>My Question is: how to make it to check my all code then move to another coordinates &amp; it will not take much time</p>

<p>Here is my some code -></p>

<pre><code>@Override
public boolean onTouchEvent(MotionEvent event) {
    int ac=event.getAction();
    int x=(int) event.getX();
    int y=(int) event.getY();

int x1=0;int x2=0;





int x3=0;int x4=0;
    boolean dont=false;
    switch(ac){
    case MotionEvent.ACTION_DOWN:

for(int i=art.length-1;i&gt;=0;i--){

    if(art[i]&lt;=Integer.valueOf(x)){
        x1=art[i];

        if(x1+2&lt;x){
            x3=x1+31;
            dont=true;
        }else{
            x3=x1+2;

        }
        break;
    }


}   

for(int i=aot.length-1;i&gt;=0;i--){
    if(aot[i]&lt;=Integer.valueOf(y)){

        x2=aot[i];


        if(y-x2==2||y-x2==1||y==x2&amp;&amp;dont==true){

            x4=x2+2;
        }else{
            x4=x2+46;


        }

        break;
            }
}


if(count.containsKey(x1+","+x2+","+x3+","+x4)){
    AlertDialog mk=new AlertDialog.Builder(getContext()).create();
    mk.setMessage("Game Over!");
    mk.show();
}
    break;
    case MotionEvent.ACTION_MOVE:


for(int i=art.length-1;i&gt;=0;i--){

    if(art[i]&lt;=Integer.valueOf(x)){
        x1=art[i];

        if(x1+2&lt;x){
            x3=x1+31;
            dont=true;
        }else{
            x3=x1+2;

        }
        break;
    }


}   

for(int i=aot.length-1;i&gt;=0;i--){
    if(aot[i]&lt;=Integer.valueOf(y)){

        x2=aot[i];


        if(y-x2==2||y-x2==1||y==x2&amp;&amp;dont==true){

            x4=x2+2;
        }else{
            x4=x2+46;


        }

        break;
            }
}


if(count.containsKey(x1+","+x2+","+x3+","+x4)){
    AlertDialog mk=new AlertDialog.Builder(getContext()).create();
    mk.setMessage("Game Over!");
    mk.show();
}

break;
    }


    return true;

}
</code></pre>

<p>Count Contain all coordinates to check for Rect in Hashmap</p>

<p>&amp; in For Loop 1st contain possible x Values</p>

<p>Second contain possible y Value</p>

<p>EDIT:</p>

<p>these are aot &amp; art Array of int;</p>

<pre><code>art[0]=7;
art[1]=36;
art[2]=65;
art[3]=94;
art[4]=123;
art[5]=152;
art[6]=181;
art[7]=210;
art[8]=239;
art[9]=268;
art[10]=297;
art[11]=326;
art[12]=355;
art[13]=384;
art[14]=413;
art[15]=442;
art[16]=471;

        aot[0]=7;
        aot[1]=51;
        aot[2]=95;
        aot[3]=139;
        aot[4]=183;
        aot[5]=227;
        aot[6]=271;
        aot[7]=315;
        aot[8]=359;
        aot[9]=403;
        aot[10]=447;
        aot[11]=491;
        aot[12]=535;
        aot[13]=579;
        aot[14]=623;
        aot[15]=667;
        aot[16]=711;
</code></pre>
