NullPointerException when using onFling Gesture
<p>im catching a NullPointerException in onFling method...
This doesnt happen always..</p>

<pre><code>    class MyGestureDetector extends SimpleOnGestureListener 
    {
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) 
        {


            try
            {
                if(e1.getX() &gt; e2.getX() &amp;&amp; (e1.getX() - e2.getX()) &gt; SWIPE_MIN_DISTANCE ) 
                {
        Log.i("Fling Gesture ","Going Right...Dec");
        Intent i = new Intent(nov.this, dec.class);
        startActivity(i);
        finish();
                }
    else if (e1.getX() &lt; e2.getX() &amp;&amp; (e2.getX() - e1.getX()) &gt; SWIPE_MIN_DISTANCE ) 
                {
    Log.i("Fling Gesture ","Going Left...OCT");

    Intent i = new Intent(nov.this, oct.class);
                    i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    overridePendingTransition(android.R.anim.slide_out_right,android.R.anim.slide_in_left);

                    startActivity(i);
                    finish();
                }

            } catch (Exception e) 
            {
            }
            return true;
        }
</code></pre>

<p>N</p>

<p>Heres my log.....</p>

<pre><code>09-07 10:44:09.584: WARN/System.err(8721): java.lang.NullPointerException
09-07 10:44:09.584: WARN/System.err(8721):     at com.MarKal11.KAL$MyGestureDetector.onFling(KAL.java:70)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
09-07 10:44:09.594: WARN/System.err(8721):     at com.MarKal11.KAL$1.onTouch(KAL.java:114)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.View.dispatchTouchEvent(View.java:3928)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:955)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
09-07 10:44:09.594: WARN/System.err(8721):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
09-07 10:44:09.604: WARN/System.err(8721):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1772)
09-07 10:44:09.604: WARN/System.err(8721):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
09-07 10:44:09.604: WARN/System.err(8721):     at android.app.Activity.dispatchTouchEvent(Activity.java:2214)
09-07 10:44:09.604: WARN/System.err(8721):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1747)
09-07 10:44:09.604: WARN/System.err(8721):     at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2336)
09-07 10:44:09.604: WARN/System.err(8721):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1976)
09-07 10:44:09.614: WARN/System.err(8721):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-07 10:44:09.614: WARN/System.err(8721):     at android.os.Looper.loop(Looper.java:143)
09-07 10:44:09.614: WARN/System.err(8721):     at android.app.ActivityThread.main(ActivityThread.java:4277)
09-07 10:44:09.614: WARN/System.err(8721):     at java.lang.reflect.Method.invokeNative(Native Method)
09-07 10:44:09.614: WARN/System.err(8721):     at java.lang.reflect.Method.invoke(Method.java:507)
09-07 10:44:09.614: WARN/System.err(8721):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-07 10:44:09.614: WARN/System.err(8721):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-07 10:44:09.624: WARN/System.err(8721):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Exception occurs only while going towards right...
Please suggest me where im wrong????....
Thanks...</p>
