当前位置: 动力学知识库 > 问答 > 编程问答 >

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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: