3

Android noob trying to figure out how exactly to do this. The goal is simple: grab an image file from the web (with a URL) and put that image onto a Google Glass card.

I have a function from this question that creates a drawable from a web url.

However, when I try to create a Google Glass card, the method card.AddImage(uri) requires a URI. I have a drawable object created from the method referenced above - how do I put this drawable object onto the card?

Is there a way to extract the URI from the drawable object? Most of the questions here deal with extracting the URI of a local resource, and since this drawable object was created "on the fly" during execution, I'm not sure how to apply URI.parse in such a situation (I don't have an absolute path to the resource).

Is this even the right approach? Should I be creating a drawable, or is there a way to retrieve the image strictly using a URI of that web address?

Community
  • 1
  • 1
  • Would this work? http://stackoverflow.com/questions/6602417/get-the-uri-of-an-image-stored-in-drawable – Jay Carlton Feb 21 '14 at 22:00
  • Why not simply use the URI you created in the first question? – ErstwhileIII Feb 27 '14 at 06:45
  • @ErstwhileIII, how would I get that? I have a function (from another question referenced above) that makes a Drawable of the web image, but the function I need to display the image requires a URI as its parameter. – user3330342 Mar 05 '14 at 21:06
  • You don't have to fetch the content for that purpose. Simply use card.addImage(new URL(address)); where address is the string with web address of the image – Pavlonator Mar 07 '14 at 04:02

1 Answers1

0

You seem to be going through more work to try to get a web-available image onto a card. Why not simply use the original web image rather than the drawable you have created (card.addImage(new URL(address))? If you need to process the image, then you would want to store it in a web available manner on your server side where you are hosting your google-mirror-api code. See the Glass sample that adds an image of a cat to a picture taken by Glass and reposts it.

ErstwhileIII
  • 4,829
  • 2
  • 23
  • 37