我有一个在线数据库,提供图像文件位置和文件名
我正在尝试更新 android 屏幕中的 imageview。这是我获取图像的代码和我尝试过的东西:
// successfully received product details
JSONArray productObj = json.getJSONArray("product"); // JSON Array
// get first product object from JSON Array
JSONObject product = productObj.getJSONObject(0);
// product with this pid found
// imageview
imageVw = (ImageView) findViewById(R.id.imageView1);
// display data in imageview
//imageStr = "http://somesite.com/images/" + product.getString("imagefile");
imageStr = "file://somesite.com/images/" + product.getString("imagefile");
//imgUri=Uri.parse("file:///data/data/MYFOLDER/myimage.png");
//imgUri=Uri.parse(imageStr);
//imageVw.setImageURI(imgUri);
imageVw.setImageBitmap(BitmapFactory.decodeFile(imageStr));