当前位置: 首页>>代码示例>>Java>>正文


Java Card.toView方法代码示例

本文整理汇总了Java中com.google.android.glass.app.Card.toView方法的典型用法代码示例。如果您正苦于以下问题:Java Card.toView方法的具体用法?Java Card.toView怎么用?Java Card.toView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.glass.app.Card的用法示例。


在下文中一共展示了Card.toView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResume

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
@Override
protected void onResume(){
	super.onResume();
	
	//Get the voice results and send them to the server.
	String command = "";
	ArrayList<String> voiceResults = getIntent().getExtras()
	        .getStringArrayList(RecognizerIntent.EXTRA_RESULTS);
	
	for(int i=0;i< voiceResults.size(); i++){
		Log.d("Voice Results", voiceResults.get(i));
		command = voiceResults.get(i);
	}
	Card card1 = new Card(getBaseContext());
	card1.setText("Sending Command:\n" + command);
	// Don't call this if you're using TimelineManager
	View card1View = card1.toView();
	sendMessage(command);
	setContentView(card1View);
}
 
开发者ID:unl-nimbus-lab,项目名称:ros_glass_tools,代码行数:21,代码来源:VoiceControlActivity.java

示例2: onCreate

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	Log.d("Startup", "STARTING");
	Intent intt = new Intent(this, ROSMonitorService.class);		
	//kill the service if it is already running because we want to subscrive to a new topic.  
	stopService(intt);

	Card card1 = new Card(this);
	card1.setText("Robot Warning Monitor");

	View card1View = card1.toView();

	// Display the card we just created
	setContentView(card1View);
	intt = new Intent(this, ROSMonitorService.class);	
	startService(intt);

}
 
开发者ID:unl-nimbus-lab,项目名称:ros_glass_tools,代码行数:20,代码来源:StartServiceActivity.java

示例3: onPostExecute

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
@Override
protected void onPostExecute(String result) {
	HashMap<String, String> params = new HashMap<String, String>();

	params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,"stringId");
	
	mSpeech.speak("One bitcoin is currently $"+result+", according to coinbase", TextToSpeech.QUEUE_FLUSH, params);
	
	Card card = new Card(getBaseContext());
	card.setText("$"+result+" USD");
	card.setInfo("Coinbase");
	card.setTimestamp(new Timestamp(new Date().getTime()).toString());
	View cardView = card.toView();
	setContentView(cardView);
}
 
开发者ID:dintskirveli,项目名称:glass-btc,代码行数:16,代码来源:MainActivity.java

示例4: onCreate

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState){	
	super.onCreate(savedInstanceState);
	
	Card card1 = new Card(this);
	card1.setText("Hello World!");
	card1.setFootnote("Footer Note ...");
	View card1View = card1.toView();
	
	setContentView(card1View);
}
 
开发者ID:carminevalentino,项目名称:templateGlassXE12,代码行数:11,代码来源:MainActivity.java

示例5: getView

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    Card card = new Card(CardActivity.this);
    card.setText("" + i);
    return card.toView();
}
 
开发者ID:briangriffey,项目名称:glass-full-activity,代码行数:7,代码来源:CardActivity.java

示例6: onReceive

import com.google.android.glass.app.Card; //导入方法依赖的package包/类
@Override
public void onReceive(Context c, Intent i) {
	
	/* Battery Level */
	int level = i.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
	int scale = i.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
	float batteryPct = (level / (float) scale) * 100;
	String cardText = "Battery Level: " + Float.toString(batteryPct)
			+ "%\n";

	/* Network Status */
	String networkState = "Network: OFFLINE\n";
	if (MainActivity.isNetworkConnected(c)) {
		networkState = "Network: " + networkInfo(c).getTypeName() + "\n";
	}			
	
	/* Uptime */
	Long uptimeMillis;
	String uptimeText = "\n";
	uptimeMillis = SystemClock.uptimeMillis();
	Long u = uptimeMillis / 1000;
	Long seconds = u % 60;
	u = u/60;
	Long minutes = u % 60;
	u = u/60;
	Long hours = u % 24;
	u = u/24;
	Long days = u;
	
	Long ten = Long.valueOf(10);
	
	String dayLabel = "days";
	if(days.equals(1L)) {
		dayLabel = "day";
	}
	
	String hoursLabel = String.valueOf(hours);
	if(hours.compareTo(ten) < 0) {
		hoursLabel = "0" + hours;
	}

	String minutesLabel = String.valueOf(minutes);
	if(minutes.compareTo(ten) < 0) {
		minutesLabel = "0" + minutes;
	}

	String secondsLabel = String.valueOf(seconds);
	if(seconds.compareTo(ten) < 0) {
		secondsLabel = "0" + seconds;
	}
	
	uptimeText = "Uptime: " + days + " " + dayLabel + " " + hoursLabel + ":" + minutesLabel + ":" + secondsLabel;

	/* Create output */
	Card card = new Card(c);
	cardText = "*** GLASS STATUS ***\n" + cardText + networkState + uptimeText;
	card.setText(cardText);
	View cardView = card.toView();
	setContentView(cardView);
}
 
开发者ID:cmenscher,项目名称:GlassStatus,代码行数:61,代码来源:MainActivity.java


注:本文中的com.google.android.glass.app.Card.toView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。