Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于在android中从url下载图像_Android - Fatal编程技术网

关于在android中从url下载图像

关于在android中从url下载图像,android,Android,我正在开发一个android应用程序,其中我有来自Url的数据,Url有3个图像和文本。我想显示列表中的所有图像和文本。我查看了一些示例Url和延迟加载,代码,,,,有人能指导我怎么做吗 这是url 这会对你有所帮助 Bitmap bmImg; void downloadFile(String fileUrl){ URL myFileUrl =null; try { myFileUrl= new URL(fileUrl);

我正在开发一个android应用程序,其中我有来自Url的数据,Url有3个图像和文本。我想显示列表中的所有图像和文本。我查看了一些示例Url和延迟加载,代码,,,,有人能指导我怎么做吗

这是url

这会对你有所帮助

Bitmap bmImg;
void downloadFile(String fileUrl){
      URL myFileUrl =null;          
      try {
           myFileUrl= new URL(fileUrl);
      } catch (MalformedURLException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
      try {
           HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
           conn.setDoInput(true);
           conn.connect();
           InputStream is = conn.getInputStream();

           bmImg = BitmapFactory.decodeStream(is);
           imView.setImageBitmap(bmImg);
      } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
 }
资料来源:

你也看到了吗

这可能会对您有所帮助

Bitmap bmImg;
void downloadFile(String fileUrl){
      URL myFileUrl =null;          
      try {
           myFileUrl= new URL(fileUrl);
      } catch (MalformedURLException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
      try {
           HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
           conn.setDoInput(true);
           conn.connect();
           InputStream is = conn.getInputStream();

           bmImg = BitmapFactory.decodeStream(is);
           imView.setImageBitmap(bmImg);
      } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
 }
资料来源:

你也看到了吗


您需要使用Listview的自定义适配器将文本与图像绑定为列表项。 请参阅以下链接:
http://negativeprobability.blogspot.com/2011/08/lazy-loading-of-images-in-listview.html

您需要使用Listview的自定义适配器将文本与图像绑定为列表项。 请参阅以下链接:
http://negativeprobability.blogspot.com/2011/08/lazy-loading-of-images-in-listview.html

在lazyloading示例中,您必须对类imageloader进行Cosmize,它会完成工作。在lazyloading示例中,您必须对类imageloader进行Cosmize,它会完成工作。但我必须下载图像和文本,并在列表视图中显示,,,,如何做到这一点但我必须下载图像和文本并在列表视图中显示,,,,,如何做到,,,,,它没有xml文件,,,,,,,,,它没有xml文件,,,,,