First of all: sorry for my bad english, i’m not. I tried to use mousePressed in android, and initially works. But after some tests, i found a serius problem. By clicking quickly at the same time with two fingers and releasing them, the mousePressed function returned magically true, until i didn’t click again. I saw that this problem exists in every Android 9 Processing code. I’m very desperate, please help me!
I don’t have a phone with Android Pie, but has your phone a variable pointer speed ?
Settings /General Management/Language and input/Pointer speed
Hi @anony;
In order to understand better what is happening, maybe you can try to add this function and print info (from Android Studio):
import android.view.MotionEvent;
.
.
.
public void surfaceTouchEvent(MotionEvent event) {
//call to keep mouseX, mouseY, etc updated
super.surfaceTouchEvent(event);
final int actionPeformed = event.getAction();
println("Event: " + event + " Action: " + actionPeformed);
}
Or you test the Ketai library which can capture gestures..
yep, in fact my function is from some reference by ketai, but I realized I was not using it in that moment
Hi @Waboqueox! I’m very happy, because of you. Your reference was very useful, and though the function return value is wrong (void), i found a very similar function that solve the problem!!
To solve the double touch problem on android processing, we’ve to add on our sketch:
import android.view.MotionEvent;
...
...
...
public boolean surfaceTouchEvent(MotionEvent event) {
if(event.getActionMasked() == MotionEvent.ACTION_UP){
mousePressed=false;
}
return super.surfaceTouchEvent(event);
}
Finally, i can work on my future android projects. Thank you very much!