我有一个URI像其中有一个形象
文件:/// MNT / ...............
如何使用URI来获取图像,但它返回null,请告诉我,我错了。
位图位= BitmapFactory.de codeFILE(uri.getPath());
点阵位图= BitmapFactory.de codeFILE(uri.toString());
解决方案
这是一个简单的一条线的方式来做到这一点:
网址URL =新的URL(HTTP:// ......);
位图图像= BitmapFactory.de codeStream(url.openConnection()的getInputStream());
I have a uri like which has an image
file:///mnt/...............
How to use this uri to get the image but it returns null, please tell me where i am wrong.
Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath());
Bitmap bitmap = BitmapFactory.decodeFile(uri.toString());
解决方案
This is a simple one line way to do it:
URL url = new URL("http://....");
Bitmap image = BitmapFactory.decodeStream(url.openConnection().getInputStream());
上一篇:在获取Android应用程序与我们联系应用程序、Android
下一篇:安卓:BitmapFactory.de codeByteArray给人像素化的位图位图、给人、像素、BitmapFactory