获取图像

时间:2011-06-16 11:44:02

标签: android arrays json parsing

在Android应用程序中 - 我发送像这样的Json字符串

{"restarutant":{"name":"Chung Wah","photo":"http:\/\/i.imgur.com\/AnXB0.jpg","address":"93, 2ndc ross, GDP etx.","area":"Vylaikaval","city":"Bangalore","location":["13.015621","77.277531"],"phone":["9986377561","08023467969"],"rating":"4","cuisines":["Chinese","Korean"],"attributes":["smoking","parking","delivery"],"gallery":["http:\/\/i.imgur.com\/9THuR.jpg","http:\/\/i.imgur.com\/05Oon.jpg","http:\/\/i.imgur.com\/fPm96.jpg","http:\/\/i.imgur.com\/sICp4.jpg","http:\/\/i.imgur.com\/JP8mG.jpg"]}}

这是下面一个数组的结果(只是为了理解阵列是如何形成的)

    $restaurant = array('restarutant' => 
array('name' => 'Chung Wah', 
      'photo' => 'http://i.stack.imgur.com/AnXB0.jpg', 
      'address' => '93, 2ndc ross, GDP etx.', 
      'area' => 'Vylaikaval', 
      'city' => 'Bangalore', 
      'location' => array('13.015621', '77.277531'),
      'phone' => array('9986377561', '08023467969'), 
      'rating' => '4', 
      'cuisines' => array('Chinese', 'Korean'), 
      'attributes' => array('smoking', 'parking', 'delivery'),
      'gallery' => array('http://i.stack.imgur.com/9THuR.jpg', 
                         'http://i.stack.imgur.com/05Oon.jpg',
                         'http://i.stack.imgur.com/fPm96.jpg', 
                         'http://i.stack.imgur.com/sICp4.jpg',
                         'http://i.stack.imgur.com/JP8mG.jpg')
));

现在活动加载时。从服务器和显示器下载这些图像的最佳方法是什么?

我们需要遵循的程序是什么?

1 个答案:

答案 0 :(得分:1)

Lazy load of images in ListView - 您将图像异步下载到视图中的最佳起点。