如何在Android中保存图像? [英] How to save images in Android?

查看:165
本文介绍了如何在Android中保存图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android编程的新手,我想知道如何让一个应用程序拍摄照片,并将图像保存到设备的内部存储,而不是SD卡,因为不是每个人都会有一个SD卡。

I'm very new to Android programming and I was wondering how can I make an app take a picture and save the image to the internal storage of a device, not to the SD card, because not everyone will have an SD card.

推荐答案

是的,您可以尝试在sqlite blob字段中保存图像。它只是一个java方式:让整个世界等待:)

Yes, you can try to save images in sqlite blob fields. It's just a java way: and let the whole world wait :)

这是一个很好的做法,存储所有的文件,缓存等到 / Android / data /< package_name> / files / 目录。 不是唯一的SD卡,您可以通过Environment.getExternalStorageDirectory()和Environment.getExternalStorageState()调用获取外部存储路径和状态( reference )。如果您使用的是API 8或更高版本,则可以使用Context.getExternalFilesDir()。

It's a good practice to store all your files, cache etc into /Android/data/<package_name>/files/ directory on external storage. External storage is not the only SD cards and you can get external storage path and state by Environment.getExternalStorageDirectory() and Environment.getExternalStorageState() calls (reference). If you are using API 8 or greater, you can use Context.getExternalFilesDir().

如果您想要获得用户的仇恨,您可以尝试将文件和文件夹存储在外部存储器的根目录中。

If you would like to get user's hate-rays, you can try to store files and folders in the root of external storage.

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

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