需要将图片保存到手机内存(而不是SD卡)的相册文件夹中。

3
我需要在手机存储器(而不是SD卡)的默认相册文件夹中创建一个文件夹。之后,我需要使用相机将图像保存到文件夹中(在相册文件夹中创建它)。
问题是我能够在SD卡中找到默认的相册文件夹并创建文件夹并将图像保存到其中,但在手机存储器中我无法看到默认的相册文件夹。有没有办法在手机存储器中查看相册文件夹?还有如何创建文件夹并将图像保存到其中。
4个回答

0

这行代码将您的图片添加到图库中:

MediaStore.Images.Media.insertImage(getContentResolver(), yourBitmap, yourTitle , yourDescription);

请注意,您还必须添加


<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

到你的manifest.xml文件


0
To create and write a private file to the internal storage:

   1. Call openFileOutput() with the name of the file and the operating mode. This returns a FileOutputStream.
   2. Write to the file with write().
   3. Close the stream with close().

For example:

String FILENAME = "hello_file";
String string = "hello world!";

FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();


Refer the link...............                

http://developer.android.com/guide/topics/data/data-storage.html#filesInternal

0

你可以在内部存储器(手机存储器)中创建文件夹并保存图像。但是,任何人都无法看到这些文件夹以及其中的图像。这就是 Android 中内部存储器的目的。


0
尝试像这样在内部存储器中创建文件夹:
    File mydir = context.getDir("mydir", Context.MODE_PRIVATE); 
    File fileWithinMyDir = new File(mydir, "myfile"); 
    FileOutputStream out = new FileOutputStream(fileWithinMyDir);

然后在将文件保存到文件夹时,给出该目录的路径并检查输出


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接