Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GoogleGlass : Add image in background : unsupported image scheme: http

I have a problem when i try to set an image URL on a Card.

Here is the error log : unsupported image scheme: http

01-16 14:11:50.188: E/AndroidRuntime(2851): FATAL EXCEPTION: main
01-16 14:11:50.188: E/AndroidRuntime(2851):
java.lang.IllegalArgumentException: unsupported image scheme: http
01-16 14:11:50.188: E/AndroidRuntime(2851):     at
com.google.android.glass.app.Card.addImage(Card.java:178)
01-16 14:11:50.188: E/AndroidRuntime(2851):     at
com.example.cupofnewsglass.MainActivity.processFinish(MainActivity.java:112)

Here is my code :

// Get img of article, it return an string like : http://img.
String imgUrl = articles.get(i).getImage();
// Get Publication Date
String pubDate = createDateForGlass(articles.get(i).getPubDate());
// Convert imgUrl to an Uri
Uri imgUri = Uri.parse(imgUrl);
// Set main text in card
card.setText(title + " ago");
// Set Footer text in card
card.setFootnote(pubDate);
// Image will be in Fullscreen mode
card.setImageLayout(Card.ImageLayout.FULL);
// Set background image in card
card.addImage(imgUri);
like image 649
wawanopoulos Avatar asked Nov 30 '25 04:11

wawanopoulos


1 Answers

This is working as intended, the only supported schemes for the Card builder class are file and android.resource.

This feature request is tracking support for web images in the Card builder class.

like image 163
Alain Avatar answered Dec 02 '25 18:12

Alain