Android 将图像保存到 SQLite 或 SDCard 或内存 [英] Android Save images to SQLite or SDCard or memory

查看:26
本文介绍了Android 将图像保存到 SQLite 或 SDCard 或内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从服务器获取图像和其他一些数据,然后将其显示在列表中.但是由于记录的数量可能非常大,所以我不确定是否应该将图像保存到 SQLite 数据库或将其保存到 SDCard 或将它们保存到内存中.

I need to fetch images and some other data from server and then display it in the List. But as the number of records can be pretty large so I am not sure if I should save images to SQLite database or save it to SDCard or save those to memory.

谢谢,无

推荐答案

总是养成保存图片路径到数据库的习惯.对于列表视图,请确保只使用这些图像的缩略图.这将帮助您快速加载列表中的这些图像.

Always make a habit of saving images path to database. For a list view, be sure just to use those image's thumbnail. This will help you in fast loading of these images in list.

 long selectedImageUri = ContentUris.parseId(Uri.parse(anniEntry.getUri()));
 Bitmap bm = MediaStore.Images.Thumbnails.getThumbnail(
                    mContext.getContentResolver(), selectedImageUri,MediaStore.Images.Thumbnails.MICRO_KIND,
                    null );

这里anniEntry.getUri()是图片uri.现在,把它放在第二个代码中.你可以根据需要获取微缩图或迷你缩图

Here anniEntry.getUri() is the image uri.Now,put it in second code.U can get micro or mini thumbnail according to requirement

这篇关于Android 将图像保存到 SQLite 或 SDCard 或内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆