android - How to capture the onSwipeDown event on google glass using a native app? -


i able capture of events triggered touchpad of google glass using simpleongesturelistener in native app.

with following code can capture these events

mainactivity.java:

private gesturedetector gesturedetector;  @override protected void oncreate(bundle savedinstancestate) {     gesturedetector = new gesturedetector(this, new mygesturelistener()); }  @override public boolean ongenericmotionevent(motionevent event) {     gesturedetector.ontouchevent(event);     return true; } 

mygesturelistener:

public class mygesturelistener extends android.view.gesturedetector.simpleongesturelistener {     @override     public boolean onfling(motionevent start, motionevent finish, float velocityx, float velocityy)     {              // check velocity direction identify swipe forward / backward / , down         return true;     }  } 

i found 2 different sources gesture processing tried:

  1. capture glass d-pad events in android
  2. capturing gesture controls use in native android glass apps

but none of them able catch swipedown event.

the callback onfling() called on "swipe forward", "swipe backward" , "swipe up" never called when "swipe down".

any hints or have managed catch swipe down? clueless here.

here (weird) solution.

it seems swipedown gesture not gesture more button click.

that means should use callback methods of activity capture these events.

private static final int key_swipe_down = 4;  @override public boolean onkeyup(int keycode, keyevent event) {     if (keycode == key_swipe_down)     {         // there swipe down event         return true;     }     return false; } 

i think not need care onkeydown() callback because callback triggered directly before onkeyup() event , not when beginning gesture.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -