Android 赢了一张卡';t出版/玻璃器皿停止

Android 赢了一张卡';t出版/玻璃器皿停止,android,google-glass,google-gdk,Android,Google Glass,Google Gdk,我正在尝试制作我的第一个Google Glass应用程序(如果算上Hello World项目的话,是第二个),需要一些帮助。我创建了第一部分,结果很好(该应用程序显示在语音命令列表和“launcher”中,我可以运行它/对它说话),所以我非常兴奋我走到了这一步!我的问题是,如何将卡片发布到时间线 package com.test.glass.glassnotes; import java.util.ArrayList; import com.google.android.glass.app.

我正在尝试制作我的第一个Google Glass应用程序(如果算上Hello World项目的话,是第二个),需要一些帮助。我创建了第一部分,结果很好(该应用程序显示在语音命令列表和“launcher”中,我可以运行它/对它说话),所以我非常兴奋我走到了这一步!我的问题是,如何将卡片发布到时间线

package com.test.glass.glassnotes;

import java.util.ArrayList;

import com.google.android.glass.app.Card;
import android.app.Activity;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.View;


public class MainActivity extends Activity {

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get voice input results
    ArrayList<String> voiceResults = getIntent().getExtras()
            .getStringArrayList(RecognizerIntent.EXTRA_RESULTS);
    String voiceString = "";
    for(String str:voiceResults){
        voiceString = voiceString + " " + str;
    }
    voiceString = voiceString.trim();

            //Create card
            Card card1 = new Card(this);
            card1.setText(voiceString);
            card1.setFootnote("GlassNotes");
            View card1View = card1.toView();

            // Display card
            setContentView(card1View);
    }
}
package com.test.glass.glassnotes;
导入java.util.ArrayList;
导入com.google.android.glass.app.Card;
导入android.app.Activity;
导入android.os.Bundle;
导入android.speech.RecognizerIntent;
导入android.view.view;
公共类MainActivity扩展了活动{
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//获取语音输入结果
ArrayList voiceResults=getIntent().getExtras()
.getStringArrayList(识别器意图.额外结果);
字符串voiceString=“”;
for(字符串str:voiceResults){
voiceString=voiceString+“”+str;
}
voiceString=voiceString.trim();
//创建卡片
Card card1=新卡(本卡);
card1.setText(语音字符串);
卡片1.设置脚注(“玻璃注释”);
视图card1View=card1.toView();
//显示卡
setContentView(card1View);
}
}
说到Java,我有点不在行,所以我边学习边学习

此外,可能值得注意的是,我正在尝试创建的应用程序是一个简单的记事本应用程序,用户将在其中说出文本,并在时间线上添加一张新卡,以供将来参考,其中包含所说的文本。我在Eclipse/ADT中使用GDK偷偷窥视来完成这项工作


提前感谢您的帮助

要将发布的卡添加到时间线,您需要使用GDK TimelineManager API,该API记录在

例如:

mTimelineManager = TimelineManager.from(this);
mTimelineManager.insert(card);
请注意,使用卡创建的时间线上的卡(静态卡)仅保留7天()