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

梦想的初衷 提交于 2019-12-10 10:26:52

问题


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);

回答1:


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.



来源:https://stackoverflow.com/questions/21167282/googleglass-add-image-in-background-unsupported-image-scheme-http

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!