HelloWorld for Google Glass

  发布于 2023-02-08 10:56

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

这是整个代码堆,我正在努力解决这个问题.编译不会产生任何错误,但运行它会.

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;
    }    
}

难道这不应该推出一张卡片上写着"哈哈,让我们看看这是否有效?"

1 个回答
  • 我在GitHub上创建了一个Hello World项目.

    通过说" ok glass,hello world "或点击时间线上显示的Hello World卡启动应用程序.

    实时卡有一个选项菜单,有两个选项:

      打招呼

      关闭应用程序

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

    2023-02-08 10:59 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有