On Mouse Touch in android - android

which function is used for keeping track of all user interactions in Android?
I have used the onuserinteraction() function, but that does not include touching the mouse.
It includes clicking the mouse or any key event.
So is there any function which keeps track of touching the mouse also?

Take a look at these links:
View.OnTouchListener
Learn Android Tutorial 1.32 – Android’s OnTouchListener and MotionEvent
I hope this helps you...

I dont think android has a "mouse". U can only use onClick listeners.

Related

Custom events corona sdk

I was wondering if I could use several events on one display table, like several custom events, touch events and enterFrame events.
If so, what are the restrictions? can I trigger an event inside an event response function?
As far as I know you can use an event inside event response function but it depends on what do you want to achieve for example an enterFrame can be trigger by a touch eventListener but some eventListener will need to complete it's function in order to trigger another eventListener like targeted events or collision event.
I haven't personally used all the events and listener so a may not cover all the restriction of it but you can refer to this link to know event and listener.
I achieved that in one of my projects. I used collision and touch event together and it worked great. So I assume that you can use events togetger. And also because of event structure its possible to triger one or more events together. ( Touching and colliding in the same time ). But I dont recommend to use enterFrame event with other events, because of performance issues
I needed to send a simulated touch event when a user pressed the menu button on an android device, and I was able to use dispatchEvent within the touch event handler
http://docs.coronalabs.com/api/type/EventListener/dispatchEvent.html

OnClickListener Hold button?

I am currently working on my final project for an intro android app development class. My final project was going to be a music player where you could click a button and it would play a certain note on a certain instrument. One thing I could not figure out is a way to have a sound file repeatedly play as a user holds a button. I understand how the OnClickListener works, but is there one for holding a button that I am missing? Thanks so much!
You need to use touch listeners, not click listeners, because the latter, as name indicates is for click and click is is one time limited event, while touch is not.
See onTouch() and in general docs: http://developer.android.com/guide/topics/ui/ui-events.html
Check out OnLongClickListener: http://developer.android.com/reference/android/view/View.OnLongClickListener.html
Use an OnTouchListener or an SimpleOnGestureListener instead. Both of these listeners distinguish between when a user presses down on the screen and lifts up their finger.

does robotium support double touch?

Does "ROBOTIUM " support 2 finger touch? Actually i want to write a testcase in which the user taps and hold one button and clicks on another button using other finger.
is that possible?
Actually, it's not supported. You can write enhancement here:
http://code.google.com/p/robotium/issues/list
It is possible, its not easy but its possible. You will need to MotionEvent which you can dispatch as per your need.

Does multi-tap fires evnets as a single tap?

Does multi-tap fires events as single-tap?
Events such:
click
pressed
released
and maybe more, because it uses another finger to create variations?
Thank You.
Yes, multitouch is detected the same way as simple touch: via onTouch(). The difference is in the supplied MotionEvent. You can check which point has been changed by getPointerId(int).
For a complete example take a look at: http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-3-understanding-touch-events/1775

Testcase with multitouch on Android?

The TouchUtils class in the android documentation has functions like drag():
https://developer.android.com/reference/android/test/TouchUtils.html#drag(android.test.InstrumentationTestCase,%20float,%20float,%20float,%20float,%20int)
but they do not support multi touch gestures, like a two finger swipe.
Looking at the MotionEvent.obtain() methods, there does not seem to be any way of invoking a "virtual" multi touch event from a testcase.
Anyone has got it working?
Apparently there is no other way than to use the private function MotionEvent.obtainNano() to mock the multi touch events. Hopefully this will change in future versions.

Categories

Resources