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.
Related
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.
I have to implement a two fingers tap.
For example I have a listView with multiple items, which already have a click listener for each row and touch listener. Now I have to do something if the user put two fingers on a row.
How can I do this?
Any suggestion is appreciated.
I believe just the gesture API only support single touch.
You basically have to override `onTouchEvent, and play with e.getPointerCount() and check the time between the ACTION_POINTER_DOWN and ACTION_POINTER_UP. You will probably also think about the case where the two touches actually do not come at the exact same time or leave the screen at the exact same time either.
Try this
Android multi-touch support
Or
http://www.rbgrn.net/content/367-source-code-to-multitouch-visible-test
android imageView: setting drag and pinch zoom parameters
This may help you.
Not sure what you mean by 2 fingers tap. If you mean a double tap (one finger, 2 taps) , I recommend this:
http://mobile.tutsplus.com/tutorials/android/android-gesture/
But if you are referring to 2 different fingers tapping once, would not recommend doing that a 2 finger tap because it goes against the Android design guidelines. If anything it is recommended to do a long press, which can easily be implemented overriding the onLongClick() method.
But if you really do not want to listen to me because you think I am stupid. You would essentially need to implement your own multi touch gesture. Here is one example:
http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-2-building-the-touch-example/1763
FYI, please be aware of what android version you want to support.
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.
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
Hi Here i want to solve the problem regarding multitouch in android. Is this possible to fire events of 2 buttons together if this is possible then how can i do this. please help regarding this. In my game application i want to do something after pressing two buttons together. How can i do this.
I don't think that it is possible to aggregate two events to a single one oob. But it shouldn't be to hard to determine if two buttons were pressed simultaneously by using a OnTouchListener you bind to the parent element of the two buttons.
When an event is thrown and the onTouch() method is called. You got a bunch of arguments related to the event, like what kind of event it was (Action_Down, Action_Move, Action_Up etc.). You also get the information if the action was performed by the first oder by the second finger so this should give you the option to decide whether both buttons were touched.
Here you can find a nice tutorial about multi touch support on Android.