Android - disable touch event while scrolling
<p>I tried all sorts of workarounds but none worked for me. I have a scrollview containing cells and each cell has an onclicklistener. these onclicklisteners add views to the mainview and I clear these subviews onscrollchanged. but if I try to click on these cells while scrolling with fling action, the app crashes. I tried putting the addition of views inside try catch blocks, but the exception was not caught there and the app crashed..</p>

<p>So I want to disable touch events when scrolling is in progress. Is there a way to do this?
The crash log is given below:-</p>

<pre><code>12-22 13:25:34.420: DEBUG/FlurryAgent(7877): Error logged: uncaught
12-22 13:25:34.430: ERROR/AndroidRuntime(7877): FATAL EXCEPTION: main
12-22 13:25:34.430: ERROR/AndroidRuntime(7877): java.lang.NullPointerException
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2188)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.View.draw(View.java:9282)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.drawChild(ViewGroup.java:2584)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.drawChild(ViewGroup.java:2582)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.drawChild(ViewGroup.java:2582)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.drawChild(ViewGroup.java:2582)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.drawChild(ViewGroup.java:2582)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.View.draw(View.java:9282)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.widget.FrameLayout.draw(FrameLayout.java:419)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1924)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewRoot.draw(ViewRoot.java:1666)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1381)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.view.ViewRoot.handleMessage(ViewRoot.java:2003)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.os.Looper.loop(Looper.java:132)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at android.app.ActivityThread.main(ActivityThread.java:4025)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at java.lang.reflect.Method.invokeNative(Native Method)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at java.lang.reflect.Method.invoke(Method.java:491)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
12-22 13:25:34.430: ERROR/AndroidRuntime(7877):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
