将输入流转换为位图

将输入流转换为位图,第1张

将输入流转换为位图

谢谢@Amir指出日志。发现了一条线:

deprer->depre returned false

这似乎是一个普遍的问题。进行搜索后,我找到了解决方案。

我以前的代码:

URLConnection conn = url.openConnection();conn.connect();inputStream = conn.getInputStream();bufferedInputStream = new BufferedInputStream(inputStream);bmp = BitmapFactory.depreStream(bufferedInputStream);

起作用的代码:

HttpGet httpRequest = null;try {    httpRequest = new HttpGet(url.toURI());} catch (URISyntaxException e) {    e.printStackTrace();}HttpClient httpclient = new DefaultHttpClient();HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);HttpEntity entity = response.getEntity();BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);InputStream instream = bufHttpEntity.getContent();bmp = BitmapFactory.depreStream(instream);

资源



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5438849.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存