在Android中保存和检索图像 [英] save and retreive image in android
本文介绍了在Android中保存和检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好...任何人都可以帮忙拍摄图像并将其保存到android中的sqlite中.检索图像并将其显示在listview中.
在此先谢谢您……:)
Jubayer
Hi everyone… Can anyone help to take images and save the image to sqlite in android.Retrieve the image and show it in listview.
Thanks in advanced… :)
Jubayer
推荐答案
尝试以下代码:
Try this code:
URL url = new URL ("file://some/path/anImage.png");
InputStream input = url.openStream();
try {
OutputStream output = new FileOutputStream ("/sdcard/myImage.png");
try {
byte[] buffer = new byte[aReasonableSize];
int bytesRead = 0;
while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) {
output.write(buffer, 0, bytesRead);
}
} finally {
output.close();
}
} finally {
input.close();
}
Have a look here[^] & here[^]
这篇关于在Android中保存和检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文