Google Glass的HelloWorld [英] HelloWorld for Google Glass

查看:89
本文介绍了Google Glass的HelloWorld的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用提供的GDK为Google Glass制作一个HelloWorld应用程序.

I'm trying to make a HelloWorld application for Google Glass by using the GDK provided.

这是整个代码栈,我正在尝试找出编程方法.编译不会产生任何错误,但是运行会产生错误.

This is the entire codestack, I'm trying to work out the way to program this. Compiling doesn't give any errors but running it does.

package leagueMatch;

import com.google.android.glass.timeline.LiveCard;
import com.google.android.glass.timeline.TimelineManager;
import com.luisdelarosa.helloglass.R;

import android.os.Bundle;
import android.os.IBinder;
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.widget.RemoteViews;

public class MainActivity extends Service {
    String blue_team, purple_team, mvp, casters;
    int blue_kills, purple_kills;

    private LiveCard mLiveCard;
    private TimelineManager mTimelineManager;
    private RemoteViews mViews;

    private static final String TAG = "LeagueMatchInfo";
    private static final String LIVE_CARD_ID = "leaguematch";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate();
        //mTimelineManager = xxxxxx;

        mViews.setTextViewText(blue_kills, "Lol, Let's see if this works");
        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
        mLiveCard.setViews(mViews);

        mLiveCard.setDirectRenderingEnabled(true);
        mLiveCard.publish(LiveCard.PublishMode.SILENT);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        return true;
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }    
}

这不是要发射一张写着大声笑,让我们看看是否行得通吗?"的卡吗?

Isn't this supposed to launch a card which says "Lol, let's see if this works?"

推荐答案

我创建了

I created a Hello World project on GitHub.

通过说"好酒杯,你好,世界"启动应用程序,或单击时间轴上显示的Hello World卡.

Start the app by saying "ok glass, hello world" or click on Hello World card shown on the timeline.

实时卡具有一个选项菜单,其中有两个选择:

The live card has an option menu with two choices:

  1. 打个招呼
  2. 关闭应用

如果有帮助,请标记为答案.

Please mark as answer if this helps.

这篇关于Google Glass的HelloWorld的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆