You can handle the onGenericMotionEvent by following these steps:
1. Add the following class to your library:
Code:
package anywheresoftware.b4a.objects;
import android.app.Activity;
import android.view.MotionEvent;
import anywheresoftware.b4a.BA;public class ActivityEx extends Activity {
@Overridepublic boolean onGenericMotionEvent(MotionEvent event) {try {
BA ba = (BA) this.getClass().getField("processBA").get(null);
ba.raiseEvent(null, "activity_ongenericmotionevent", event);returntrue;} catch (Exception e) {
throw new RuntimeException(e);
}
}
[USER=69643]@override[/USER]
public void onUserInteraction() {
super.onUserInteraction();
try {
BA ba = (BA) this.getClass().getField("processBA").get(null);
ba.raiseEvent2(null,true, "activity_onuserinteraction", false);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
Add the following line to your activity:
Code:
#Extends: anywheresoftware.b4a.objects.ActivityEx
And handle the events in your code:
Code:
Sub Activity_OnUserInteractionLog("OnUserInteraction")End SubSub Activity_OnGenericMotionEvent(eventAs Object)Log(event)End Sub
The OnUserInteraction is just an example. You can remove it.