GoogleGlass: добавить изображение в фоновом режиме: неподдерживаемая схема изображения: http
У меня проблема при попытке установить URL-адрес изображения на Card
,
Вот журнал ошибок: 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)
Вот мой код:
// 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 ответ
Решение
Это работает как задумано, единственные поддерживаемые схемы для класса Card Builder: file
а также android.resource
,
Этот запрос функции отслеживает поддержку веб-изображений в классе Card Builder.