保存它来自服务器的android图像的最佳方法 [英] Best way to save images which comes from server in android

查看:98
本文介绍了保存它来自服务器的android图像的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序,并从服务器获取产品图片。 目前,我节省了这些图像到SQLite数据库转换成字节数组,在使用时间后,我将其转换回位图。

I am working on one application and getting product images from the server. Currently I am saving those images into the SQLite database after converting them into byte array and at the time of use I convert them back into bitmap.

现在我有下面两个查询:

Now I have below two queries:

  1. 什么是保存在这里我们可以将它们同步也当过需要得到应用图像的最佳方式。

  1. What is the best way to save the images in app from where we can sync them also and get when ever required.

如何分配他们的图像视图或按钮,因为有时记忆问题的出现和应用突然停止。

How to assign them on image view or button because sometimes memory issue arises and application stop suddenly.

请指引我。任何帮助是AP preciated。

Please guide me. Any help is appreciated.

推荐答案

存储应用具体的事情上的SD卡可能不是正确的方式.. 你应该存储在

Storing app specific things on SD Card may not be the right way.. You should store images on

// it will reside in data/data/com.package.name 
String path = getApplicationContext().getFilesDir() + "/";
File imagesFolder = new File(path);
imagesFolder.mkDir();

,并把图像文件,在此文件夹..所以SD卡依赖性可以被删除。

and put image files here in that folder.. So SD Card dependency can be removed.

这篇关于保存它来自服务器的android图像的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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