當前位置: 首頁>>代碼示例>>Java>>正文


Java DataMap.getAsset方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:hieple7985,項目名稱:nano-go-ubiquitous,代碼行數:19,代碼來源:SunshineWearListenerService.java

示例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);
    }
}
 
開發者ID:chi6rag,項目名稱:SunshineWear,代碼行數:9,代碼來源:SunshineClient.java

示例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);
}
 
開發者ID:frank-tan,項目名稱:Sunshine-Android-Wear,代碼行數:14,代碼來源:DigitalWatchFace.java


注:本文中的com.google.android.gms.wearable.DataMap.getAsset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。