0

In android, how can I define a key combination in app to perform some action?

For example, if user press e and x letters on a keyboard at the same time, how can I assign a special task to do when this event is fired?

greuze
  • 4,250
  • 5
  • 43
  • 62
Bhawna Raheja
  • 619
  • 4
  • 11

2 Answers2

0

You should know that any app you make will only capture 1 touch event at a time unless you utilize multi-touch. So first do this , here , this may help ,this was asked here before too.

Community
  • 1
  • 1
Ahmed I. Elsayed
  • 2,013
  • 2
  • 17
  • 30
0
public boolean onTouchEvent(MotionEvent event) {
int x = (int)event.getX();
int y = (int)event.getY();
switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
    case MotionEvent.ACTION_MOVE:
    case MotionEvent.ACTION_UP:}
return false;}

From this you would get the postion of yout touch.Now do some logic on setOnClickListner of other button or "x" here.

Hope it helps.

Hitesh Danidhariya
  • 709
  • 1
  • 7
  • 14