I write an app for google glass platform using the gdk.
how can I detect and react to head movement?
I don't find the proper listener not the Gesture enum (e.g. Gesture.SWIPE_UP)
gestureDetector.setBaseListener(new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP) {
//do something
}
return true;
} else if (gesture == Gesture.SWIPE_UP) {
gestureDetector.setScrollListener(new ScrollListener() {
@Override
public boolean onScroll(float arg0, float arg1, float arg2) {
// TODO Auto-generated method stub
return false;
}
})
Take a look here: https://developers.google.com/glass/develop/gdk/location-sensors . It should help you out with the accelerator and other sensors that are accessible via the GDK. The code you have copied is for the touch pad, not for head movement.