Android code, Activity.onTouchEvent Unknown Source
<p>Hi have changed a Opencv example, to only add action when user touch the screen.
The code have tree class. FdActivity which extends Activity, FdViewBase which extends SurfaceView and implements SurfaceHolder.Callback , and finally FdView extends FdViewBase.</p>

<p>The onCreate method of FdActivity:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);            
        setContentView(new FdView(this));        
      }
</code></pre>

<p>FdViewBase have in class constructor the method call 'setFocusable(true);' .<br>
And finally onTouchEvent code:</p>

<pre><code>public boolean onTouchEvent(MotionEvent event) {                  
         //   if (event.getAction() == MotionEvent.ACTION_DOWN) 
              Log.i(TAG,"DOWN");                
            Log.i(TAG,"/\");
            return true;
        }
</code></pre>

<p>No compile or execute error happens with the code in this way, but if I uncomment the if statement, I get this error message:</p>

<pre><code>04-16 21:59:06.011: I/OpenCV_NativeCamera(8952): ### Camera FPS ### [780] Frames, 12.84 FPS
    04-16 21:59:06.662: D/AndroidRuntime(8952): Shutting down VM
    04-16 21:59:06.662: W/dalvikvm(8952): threadid=1: thread exiting with uncaught exception (group=0x40018560)
    04-16 21:59:06.732: E/AndroidRuntime(8952): FATAL EXCEPTION: main
    04-16 21:59:06.732: E/AndroidRuntime(8952): java.lang.NullPointerException
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at org.opencv.samples.fd.FdActivity.onTouchEvent(Unknown Source)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.app.Activity.dispatchTouchEvent(Activity.java:2099)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1721)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2200)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1884)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.os.Handler.dispatchMessage(Handler.java:99)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.os.Looper.loop(Looper.java:130)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at android.app.ActivityThread.main(ActivityThread.java:3835)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at java.lang.reflect.Method.invokeNative(Native Method)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at java.lang.reflect.Method.invoke(Method.java:507)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
    04-16 21:59:06.732: E/AndroidRuntime(8952):     at dalvik.system.NativeStart.main(Native Method)
    04-16 21:59:07.432: I/OpenCV_NativeCamera(8952): ### Camera FPS ### [810] Frames, 21.09 FPS
    04-16 21:59:08.864: I/OpenCV_NativeCamera(8952): ### Camera FPS ### [840] Frames, 21.00 FPS
    04-16 21:59:12.588: I/OpenCV_NativeCamera(8952): ### Camera FPS ### [870] Frames, 8.04 FPS
    04-16 21:59:13.168: I/Process(8952): Sending signal. PID: 8952 SIG: 9
</code></pre>

<p>I don't know why it's happing, it's appears that the event source isn't visible.</p>

<p>Eclipse didn't displayed any warning or error messages, no other error appears in LogCat.
So anybody knows whys it's happing? </p>

<p>Thanks =]</p>
