使目录中的文件的内部存储 [英] Make directories in files internal storage

查看:118
本文介绍了使目录中的文件的内部存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么做目录的内部存储?

How do i make directories in internal storage?

我尝试这样做:

File file = getFilesDir();

这让我进入到文件夹/data/data/com.mypackages/files /

this makes me goes to folder "/data/data/com.mypackages/files/"

然后我想打一个文件夹,再在该目录中,比方说,我想拍myfiles的文件夹,在那里,使其成为/data/data/com.mypackages/files/myfiles/。

Then i want to make a folder again in that directories, let's say i want to make "myfiles" folder in there so it becomes, "/data/data/com.mypackages/files/myfiles/".

谁能告诉我怎么样?

我也试过这样的:

File file = getDir("myfiles", MODE_PRIVATE);

有使该文件夹,但其用APP_创建的,所以目录变为/data/data/com.mypackages/app_myfiles。我不想说,因为我无法读取该文件夹,如果它在那里有APP_。

It makes the folder, but it was created with "app_", so the directories becomes "/data/data/com.mypackages/app_myfiles". I don't want that because i can't read the folder if it has "app_" in there.

推荐答案

解决的办法是在你的眼睛:D

The solution is under your eyes :D

m_applicationDir = new File(this.getFilesDir() + "");
m_picturesDir = new File(m_applicationDir + "/pictures");

通过这个code,我保存m_applicationDir包的目录(在你的情况下保存文件的目录)。 然后,只需创建一个子目录命名的图片。

With this code, i save in m_applicationDir the dir of the package (in your case the dir saved in file). Then simply create a sub-directory named pictures.

所以m_picturesDir指向:

So m_picturesDir points to:

/data/data/com.mypackages/files/pictures

这篇关于使目录中的文件的内部存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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