Moddasir
Moddasir

Reputation: 1459

How do I set background image in the timeline

I am trying to set background image in the timeline of google glassware.

How do I do it? How do I get image in view page?

I try to set image url as attachment like

TimelineItem timelineItem = new TimelineItem(); 
timelineItem.setText("Hello world"); 
InputStreamContent mediaContent = new InputStreamContent(contentType, attachment); 
service.timeline().insert(timelineItem, mediaContent).execute();

then service.timeline().insert(timelineItem, mediaContent).execute(); gives null pointer exception.

Upvotes: 0

Views: 374

Answers (1)

Scarygami
Scarygami

Reputation: 15569

Have you had a look at the Google Mirror API Playground?

One of the templates shows a timeline card with a full-bleed background image, using this html for the card:

<article class="photo">
  <img src="%background-image-url%" width="100%" height="100%">
  <div class="photo-overlay"></div>
  <section>
    <p class="text-auto-size">%CardText&</p>
  </section>
</article>

Alternatively you can also add the image you want as attachment and only provide the text part in the timeline item. This will use the attached image as full-bleed background image and display the text on top, as described here: https://developers.google.com/glass/timeline#inserting_a_timeline_item_with_media

Upvotes: 1

Related Questions