0

I am using the MonkeyRunner Drag functionality, which always does long presses instead of Drag events. Is it possible to disable long press? Is there any other solution for this?

Charlie-Blake
  • 10,832
  • 13
  • 55
  • 90

2 Answers2

0

You can try to override the onLongClick() method and leave it empty for not performing any action.

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • i am giving the drag command from the PC to the android device.Actually i am not touching the source code of the android app. So i cant proceed this.. Some where in the stack overflow i have found that we need to disable the long press like that – user2160741 Mar 12 '13 at 11:48
0

You can check if the user "is a monkey" with android.app.ActivityManager.isUserAMonkey()

So just disable your OnLongClickListener if the user is a monkey.

if (ActivityManager.isUserAMonkey()){
    myView.setOnLongClickListener(new OnLongClickListener(){
        @Override
        public boolean onLongClick(View v) {
            // TODO Auto-generated method stub
            return false;
        }
    });

}
Charlie-Blake
  • 10,832
  • 13
  • 55
  • 90
  • i am giving the drag command from the PC to the android device.Actually i am not touching the source code of the android app. So i cant proceed this.. Some where in the stack overflow i have found that we need to disable the long press like that – user2160741 45 secs ago edit i am giving the drag command from the PC to the android device.Actually i am not touching the source code of the android app. So i cant proceed this.. Some where in the stack overflow i have found that we need to disable the long press like that – user2160741 Mar 12 '13 at 11:51
  • AFAIK, no, there's no way to disable long presses via settings. – Charlie-Blake Mar 12 '13 at 11:54
  • then y the monkey runner drag command is not working properly..WE have given coordinates with '1' step and '0' ms delay.. even though its taking as a long press – user2160741 Mar 12 '13 at 11:57
  • Are you testing a custom view? – Charlie-Blake Mar 12 '13 at 12:10