Newts
Newts

Reputation: 1372

How to pass object from android mobile to android wear?

I tried different ways to pass class object using DataMap but its not correct way. Please suggest any way to pass class object from phone to wear.

Upvotes: 0

Views: 165

Answers (2)

abielita
abielita

Reputation: 13469

You may want to check these SO threads 1 and 2 on how to use DataMap to pass and retrieve the object. The way to access previously stored data is with the DataApi methods. For example, you can get all stored data with Wearable.DataApi.getDataItems().

Upvotes: 1

Andrey Danilov
Andrey Danilov

Reputation: 6602

Since you can pass String you can pass serialized object of your class.

So you can use GSON library for object serialization and deserialization.

Upvotes: 0

Related Questions