我一直在尝试多种方式来显示我的json图像,但我的解决方案从未成功。如何显示此json图像
我已经解析了我的json,并且得到了响应。
但是,包含respose是一个图像,我需要在我的应用程序中显示。
收到图像为:“http://media.rightmove.co.uk/31k/30471/29462938/30471_FLE100159_IMG_00_0002_max_200x1 38.jpg”这只是string.I在我的数据库中有下面这些图像。
如何在我的应用程序中显示这些图像?
![解析的图像] [1]
预先感谢
下面的代码。
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
JSONParser prop = new JSONParser();
JSONObject json = prop.getJSONFromUrl(url);
try{
properties = json.getJSONArray(TAG_PROPERTY);
for (int i = 0; i < properties.length(); i++) {
JSONObject c = properties.getJSONObject(i);
String photoThumbnailUrl = c.getString(TAG_PHOTOS);
// load image view control
imgView = (ImageView) findViewById(R.id.imgView);
// grab image to display
try {
imgView.setImageDrawable(grabImageFromUrl(photoThumbnailUrl));
} catch (Exception e) {
txtUrl.setText("Error: image not grabed");
}
}
}catch (Exception ex) {
txtUrl.setText("Error: Properties not recieved");
}
}
非常感谢
可能重复[如何在Android中通过url加载imageview?](http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-url-in-android) – 2012-02-19 15:43:36