6

For some reasons I have to disable the multi-touch feature on my app. The user can press only one button at a time, or the app would crash. Is there any way to implement this requirement?

Thanks a lot!

TofferJ
  • 4,678
  • 1
  • 37
  • 49
Paul Ma
  • 469
  • 2
  • 5
  • 15
  • See the answers for this question: http://stackoverflow.com/questions/8570982/disable-or-prevent-multitouch-in-activity – TofferJ Sep 14 '12 at 07:08

2 Answers2

20

To prevent this you should turn off splitMotionEvents or windowEnableSplitTouch attribute inside ViewGroup were buttons are located.

android:splitMotionEvents="false"
Dmytro Danylyk
  • 19,684
  • 11
  • 62
  • 68
  • So what happens if an app has a deep view hierarchy and there are buttons at the leaf nodes of the hierarchy? We need to mark every ViewGroup up to the root with this attribute? – satur9nine Mar 12 '14 at 01:41
  • Yes you are right, second approach is to create custom view group and override `onTouchEvent` there. Example is here: http://goo.gl/pRXtCk – Dmytro Danylyk Mar 12 '14 at 07:33
0

add this line to your manifest

< uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
Adam
  • 418
  • 4
  • 14