我试图从url网站获取
ImageView中的图像,但图像没有显示,
这段代码有什么问题?
这是
image的网址.
这是我的主要活动
ImageView i;
private Bitmap bitmap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
i=(ImageView)findViewById(R.id.ImageView1);
bitmap=GetBitmapfromUrl("http://test-dashboard1.seeloz.com/system/images/products_images/86/5454544114_1401886223?1401886223");
i.setImageBitmap(bitmap);
}
public Bitmap GetBitmapfromUrl(String scr) {
try {
URL url=new URL(scr);
HttpURLConnection connection=(HttpURLConnection)url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input=connection.getInputStream();
Bitmap bmp