本文介绍了Google Glass Eye手势崩溃(EyeGestureLib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 EyeGestureLib 从Glass检查Wink.

I am trying to check Wink from Glass using the EyeGestureLib.

我创建了一个新项目,并完全按照示例项目中的家伙进行操作此处.

I created a new project and did exactly what the guy did with the sample project here.

我的代码的问题部分如下:

The problem part of my code is below:

private EyeGestureManager mEyeGestureManager;
private EyeGestureListener mEyeGestureListener;

private EyeGesture target1 = EyeGesture.WINK;
private EyeGesture target2 = EyeGesture.DOUBLE_BLINK;

在onCreate里面,我有:

Inside onCreate, I have:

    mEyeGestureManager = EyeGestureManager.from(this);
    mEyeGestureListener = new EyeGestureListener();

    // print out each eye gesture is supported or not
    for (EyeGesture eg : EyeGesture.values()) {
        boolean supported = mEyeGestureManager.isSupported(eg);
        Log.d(TAG, eg.name() + ":" + supported);
    }

我的程序在打开后立即崩溃.我意识到问题是当它尝试访问时mEyeGestureManager.使用mEyeGestureManager的代码中的任何位置都会使程序崩溃.根据我观察到的情况,即使在mEyeGestureManager = EyeGestureManager.from(this);

My program crashes immediately after opening. I realize that the problem is when it tries to access mEyeGestureManager. Any where in the code that uses mEyeGestureManager will make the program crash.According to what I observed, mEyeGestureManager is null even after mEyeGestureManager = EyeGestureManager.from(this);

当我更改

mEyeGestureManager = EyeGestureManager.from(this);

mEyeGestureManager = new EyeGestureManager();

它不再崩溃,并且mEyeGestureManager不再为null,但不会检测到眨眼或双眨眼.

it stops crashing and mEyeGestureManager is no longer null but won't detect wink, or double wink.

我的玻璃杯运行的是XE21,但我将其降级为XE18.3,因为我的研究表明 EyeGestureLib 在Glass版本> XE18.3上无法正常工作.

My glass was running XE21 but I downgraded it to XE18.3 because my research shows that EyeGestureLib wont work properly on Glass version > XE18.3.

EyeGestures无法在19.1中运行

https://github.com/thorikawa/EyeGestureLib/issues/2

现在我有XE18.3,但是它不起作用.眨眼时我不工作mEyeGestureManager = new EyeGestureManager();然后我得到:

Now I have XE18.3 but it is not working. Wink is not working when I have mEyeGestureManager = new EyeGestureManager();and I get:

Supported:﹕ BLINK:false
Supported:﹕ DOFF:false
Supported:﹕ DON:false
Supported:﹕ DOUBLE_BLINK:false
Supported:﹕ DOUBLE_WINK:false
Supported:﹕ LOOK_AT_SCREEN:false
Supported:﹕ LOOK_AWAY_FROM_SCREEN:false
Supported:﹕ WINK:false

但是当我有:

mEyeGestureManager = EyeGestureManager.from(this);

它立即崩溃.

我去安装了已经编译好的示例"EyeGestureDemo-debug-1.1.apk" 工作效果很好,但我的效果不好.

I went and installed already compiled example "EyeGestureDemo-debug-1.1.apk" and that WORKED very well but mine does not.

我做错了什么?我已经尝试了3天了. Google对此没有官方的API,但是我不想等到他们发布一个.我的学校项目需要这个.任何人都知道可能是什么问题吗?

What am I doing wrong? I have been trying to do this for 3 days now. Google doesn't have an official API for this but I don't want to wait till they release one. I need this for my school project ASAP.Anyone got any ideas of what might be the problem?

崩溃日志

12-02 09:39:54.347    3758-3758/com.inno.inno.glassplugin D/AndroidRuntime﹕ Shutting down VM
12-02 09:39:54.347    3758-3758/com.inno.inno.glassplugin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41f78bd8)
12-02 09:39:54.363    3758-3758/com.inno.inno.glassplugin E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.inno.inno.glassplugin, PID: 3758
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.inno.inno.glassplugin/com.inno.inno.glassplugin.MainActivity}: java.lang.NullPointerException
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2235)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2285)
            at android.app.ActivityThread.access$800(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5061)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
            at com.inno.inno.glassplugin.MainActivity.onCreate(MainActivity.java:92)
            at android.app.Activity.performCreate(Activity.java:5236)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1089)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2285)
            at android.app.ActivityThread.access$800(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5061)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
            at dalvik.system.NativeStart.main(Native Method)

推荐答案

API很久以前发生了变化(我认为是XE 20左右).

The API has changed a long time ago (around XE 20 I think).

我必须做大量的反思工作才能弄清EyeGestureManager的工作原理.

I had to do quite a bit of digging with reflection to figure out the workings of EyeGestureManager.

这是我的更新版本,以及一些演示用法的示例代码: https://gist.github.com /victorkp/9094a6aea9db236a97f3

Here's my updated version, along with some sample code demonstrating usage: https://gist.github.com/victorkp/9094a6aea9db236a97f3

这篇关于Google Glass Eye手势崩溃(EyeGestureLib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 08:51