本文整理匯總了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);
}