0

I'm trying to use the following documented API:

https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/Card#addImage%28android.net.Uri%29

in a similar way to this post:

NullPointerException when calling Card.addImage(Uri)

but I'd like to use a an animated gif as the background for an immersion card instead.

Possible?

Community
  • 1
  • 1
pland
  • 858
  • 1
  • 9
  • 17

1 Answers1

1

The layouts built by the Card class use Android's ImageView to represent their images, and the ImageView widget does not support animated GIFs. You would need to construct your own layout and manage the animation manually.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • Thanks very much Tony. I see that perhaps I could use the android Movie class to decode the byte stream into a view...but I'm unable to find docs on https://developers.google.com/glass that illuminate how to construct my own layout. Would you have any pointers? Perhaps this is something one could tackle through theme customisation? I realize glass sdk imposes it's own theme of course...I'm just learning the gdk and wanted a simple immersion card playing a tiny looped movie (doesn't have to be .gif) – pland Jan 06 '14 at 15:26
  • Just to add: I realise you're just talking about a common android layout, as I've just tried building my own and of course it shows up if I just build my own layout and point at it from manifest (kinda spooky seeing 'normal' android app view spawn with battery use icons up top and all in Glass!)...so I guess the point is I now need to create a layout that follows Glass style guide for immersions, with a 640 × 360 pixel screen? – pland Jan 06 '14 at 15:41
  • As long as your layouts don't specify a theme (or use `Theme.DeviceDefault`), you should not be seeing any status bar adornments. As for the layout, you can just create a regular Android layout that follows the Glass style guidelines (640 × 360, 40px margins) and place whatever widgets you need on it. – Tony Allevato Jan 06 '14 at 16:24
  • @TonyAllevato I know this is from January but is there any reason WHY animated GIFs aren't supported? It seems insane to me that we couldn't accomplish this without going through great effort. – Stephen Tetreault Nov 04 '14 at 17:52
  • That would be a feature request for Android, not something that's Glass-specific, since `CardBuilder` uses a standard `ImageView` under the hood for its mosaics. If you would like to have animated GIF support, I would recommend filing a feature request on Android's issue tracker. – Tony Allevato Nov 04 '14 at 18:52