本文整理汇总了Java中com.google.android.gms.wearable.DataMap.getAsset方法的典型用法代码示例。如果您正苦于以下问题:Java DataMap.getAsset方法的具体用法?Java DataMap.getAsset怎么用?Java DataMap.getAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.wearable.DataMap
的用法示例。
在下文中一共展示了DataMap.getAsset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDataChanged
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
for (int i = 0; i < dataEvents.getCount(); i++) {
DataEvent event = dataEvents.get(i);
if (event.getType() == DataEvent.TYPE_CHANGED &&
event.getDataItem().getUri().getPath().equals(APP_DATA_UPDATE_REQUEST)) {
DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap();
Asset asset = dataMap.getAsset("dataIcon");
WatchFaceService.highTemp = dataMap.getInt("dataHigh");
WatchFaceService.lowTemp = dataMap.getInt("dataLow");
doLoadBitmap(asset);
}
}
}
示例2: fetchWeatherIconAsynchronously
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private void fetchWeatherIconAsynchronously(DataMap weatherDataMap) {
Asset iconAsset = weatherDataMap.getAsset(WeatherRequestKeys.ICON);
if (googleApiClient.isConnected()) {
PendingResult<DataApi.GetFdForAssetResult> fileDescriptorForIconAsset =
Wearable.DataApi.getFdForAsset(googleApiClient, iconAsset);
obtainWeatherIconUsingFileDescriptor(fileDescriptorForIconAsset);
}
}
示例3: extractWeatherData
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
/**
* Get weather info from the dataMap object provided
* @param dataMap
*/
void extractWeatherData (DataMap dataMap) {
mHighTemp = dataMap.getString(HIGH_TEMP);
mLowTemp = dataMap.getString(LOW_TEMP);
Log.i("WATCH","High temp: "+mHighTemp);
Log.i("WATCH", "Low temp: " + mLowTemp);
Asset weatherIconAsset = dataMap.getAsset(WEATHER_ICON);
loadBitmapFromAsset(weatherIconAsset);
}