Search code examples
wear-osandroid-wear-data-api

Android Wear: Asset in dataMap but can't be retrieved?


I'm storing a thumbnail picture with my data as an asset. On the Wear side, it doesn't show up sometimes. However, if I debug, I can clearly see that the DataMapItem does contain a HashMapEntry with key "photo" and data behind it "Asset[@<RANDOM_CHARACTERS>]"

However, calling dataMapItem.getDataMap().getAsset("photo") returns null.

Picture of the debug session


Solution

  • Your asset has the key "photo " - note the space at the end, yet you try to retrieve it using "photo". The keys need to match exactly.