我可以将图片网址传递给鸟舍图片编辑器,而不是从厨房中挑选照片吗?
我试过这个
Intent newIntent = new Intent(this, FeatherActivity.class);
newIntent.setData(imageURI);
startActivityForResult(newIntent, 1);
但我想要URL而不是URI。
答案 0 :(得分:1)
试试这个:
String image_url = "http://www.test.com/abc.jpg";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(image_url));
startActivity(i);
看,如果有效。
答案 1 :(得分:0)
试试这个::
public class ImageFromUrlExample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imgView =(ImageView)findViewById(R.id.ImageView01);
Drawable drawable = LoadImageFromWebOperations("http://www.androidpeople.com/wp-content/uploads/2010/03/android.png");
imgView.setImageDrawable(drawable);
}
private Drawable LoadImageFromWebOperations(String url)
{
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
}catch (Exception e) {
System.out.println("Exc="+e);
return null;
}
}
}