austgl / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Is there any way to long click the hardware home button? #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I know one can use solo.sendKey() to click the hardware home button, but is 
there any way to long click it? If not, any plans to implement it?

Original issue reported on code.google.com by yeosuan...@gmail.com on 30 May 2011 at 1:29

GoogleCodeExporter commented 9 years ago
No, there is no way to long press the home key using robotium. There is no plan 
to add a feature like that.

Original comment by renasr...@gmail.com on 30 May 2011 at 1:05

GoogleCodeExporter commented 9 years ago
I found a way to longpress the Homebutton,

generate a KeyEvent, and send using Instrumentation.

sample code as below,

long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
KeyEvent event = new KeyEvent(downTime, eventTime, KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_HOME, 1);

solo.inst.sendKeySync(event);

Original comment by vkrishn...@gmail.com on 17 Apr 2013 at 12:21