highzivs
highzivs

Reputation: 25

How to disable multi-touch function for Android App

So I have created Mobile App called PushApp using Python library Kivy. App lets user input number of how many pushups he wants to do. Then its supposed to decrement the number by one when chest hits screen(button). If screen is touched by multiple body parts it decrements many numbers. I would like to know how to disable multitouch function for Android phones at least.

Regards, Highzivs

Upvotes: 0

Views: 354

Answers (1)

highzivs
highzivs

Reputation: 25

I have managed to solve this problem by creating function (BUTTON_DOWN()) that returns how many times button has been pushed down and function (BUTTON_UP) that returns button release times. Then I created function (PUSH_UP) which returns true if BUTTON_DOWN()==BUTTON_UP()

in Python:

class CountScreen(Screen):
    DOWN_COUNT=0
    UP_COUNT=0
    PUSH_UP_COUNT=0

def BUTTON_DOWN(self):
    self.DOWN_COUNT=self.DOWN_COUNT+1
    return self.DOWN_COUNT

def BUTTON_UP(self):
    self.UP_COUNT=self.UP_COUNT+1
    return self.UP_COUNT

def PUSH_UP(self):
    if self.BUTTON_UP()==self.BUTTON_DOWN():
        return True

in Kivy:

<CountScreen>:
    name:"CountingWindow"
    GridLayout:
        cols:1
    Label:
        id:lbl_1
        font_size:400
        text:""

    Button:
        id:"btn_1"
        background_color:(0,0,0,.1)
        on_press:
            root.BUTTON_DOWN()
        on_release:
            root.BUTTON_UP()
            if root.PUSH_UP():lbl_1.text=str(int(lbl_1.text)-1) #DECREMENTS 1 FROM USER INPUT
            if lbl_1.text == '0':app.root.current="FinalScreen" #GO TO FINAL WINDOW WHEN FINISHED

Upvotes: 1

Related Questions