Posts

Showing posts from July, 2014

Wear gist#4: How to use a simple a GridViewPager with a FragmentGridPagerAdapter

Image
It is very simple to use the FragmentGridPagerAdapter in your Android Wear App.

You can build a new CardFragment with the default layout including title, text and icon using the method: CardFragment.create(page.mTitle, page.mText, page.mIconId)
Also you can provide a background overriding the getBackground(int row, int col) method in your adapter.

Very useful the class ImageReference which provides a reference to an image

Here a small gist

Wear gist #3:how to start an Activity on the mobile handheld from the Android Wear device

You can start an Activity on the mobile handheld from your Wear device. In order to achieve it you have to:

In your wear activity:
connect the GoogleApiClient get the node[1] connected send the message with the Wearable.MessageApi.sendMessage[2]

In your mobile app:
register a WearableListenerService start the intent when the message is received
Here a little (and improvable) gist:
https://gist.github.com/gabrielemariotti/117b05aad4db251f7534

[1]:http://developer.android.com/reference/com/google/android/gms/wearable/NodeApi.html#getConnectedNodes(com.google.android.gms.common.api.GoogleApiClient)

[2]:http://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html#sendMessage(com.google.android.gms.common.api.GoogleApiClient, java.lang.String, java.lang.String, byte[])

Wear gist#2: Battery details

Image
Here a little gist to get details from your battery in your wear device.

https://gist.github.com/gabrielemariotti/b49cf077d184e8b26378

Wear gist#1: How to get the heart rate on the Samsung Gear Live.

Image
Here a little gist to get the heart rate on the Samsung Gear Live.

https://gist.github.com/gabrielemariotti/d23bfe583e900a4f9276

Android-L gist#1 : Floating Action Button

Image
Here you can find a little gist to build a simple Floating Action Button with shadow, ripple and outline.

Of course it requires Android-L preview.

Linkhttps://gist.github.com/gabrielemariotti/d1baf785c2444d29819c

This code is built watching the #io14 videos, and mainly checking code at https://github.com/romainguy/google-io-2014.