URL aURL = new URL(url);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
本文详细介绍了如何使用Java代码解析URL,通过URLConnection连接到指定的URL,获取URL的输入流,并利用BufferedInputStream和BitmapFactory解码流以获取图片。步骤包括创建URL对象、打开连接、发送请求并接收响应,最后将图片流解码为Bitmap对象。
1629

被折叠的 条评论
为什么被折叠?



