'How to not count a swipe for a press in kotlin android studio
I'm building a game that when the user pressed in to first activity title screen it starts the game but I don't want to count a swipe as a click because the user might go back home etc so this is what I tried and it didn't work:
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN) {
if ((event.action != MotionEvent.ACTION_MOVE)) {
titlesound?.stop()
val gameActivity = Intent(this, GameActivity::class.java)
startActivity(gameActivity)
return true
}
}
return super.onTouchEvent(event)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|