当我使用getFilesDir()存储内容时,包含数据的文件夹在哪里?

时间:2022-05-06 16:51:36

I am writing an AndroidApp, where I save some Data by using the following File:

我正在编写一个AndroidApp,我使用以下文件保存了一些数据:

File File = new File(getFilesDir(), "Kategories.txt");

Then I create a FileWriter and so on...

然后我创建一个FileWriter等等......

First of all: IT WORKS!!! The Data gets saved and when I reopen the app, the program is able to get the data out of the Storage.

首先:它工作!!!数据被保存,当我重新打开应用程序时,程序可以从存储中获取数据。

BUT, I cant find the Data-Files in the Storage!!! I have seached it everywhere! In the Internal Storage, in storage/Android/data/ my package name is not there... Where could it be?!

但是,我无法在存储中找到数据文件!我到处都是它!在内部存储中,在存储/ Android / data /我的包名不存在......它可能在哪里?!

PS: I use Android Studio:)

PS:我使用Android Studio :)

2 个解决方案

#1


1  

I cant find the Data-Files in the Storage!

我无法在存储中找到数据文件!

The file is stored in what the Android SDK refers to as internal storage. You can access this using the Device File Explorer in Android Studio, but only for debuggable apps.

该文件存储在Android SDK所指的内部存储中。您可以使用Android Studio中的设备文件资源管理器访问它,但仅适用于可调试应用程序。

In the Internal Storage, in storage/Android/data/ my package name is not there

在内部存储中,在存储/ Android / data /我的包名称不存在

That is what the Android SDK refers to as external storage.

这就是Android SDK所指的外部存储。

#2


0  

If you search with an file explorer on your app you wont be able to find it, because your files are private. Have a look at the documentation:

如果您在应用上使用文件浏览器进行搜索,则无法找到它,因为您的文件是私有的。看看文档:

Files saved here are accessible by only your app

此处保存的文件只能由您的应用访问

If you want the files to be public have a look at this section. Then you should use getExternalStoragePublicDirectory() instead of getFilesDir(). If you want your files to be on internal storage and public look at this answer.

如果您希望文件公开,请查看此部分。然后你应该使用getExternalStoragePublicDirectory()而不是getFilesDir()。如果您希望您的文件位于内部存储和公共内容,请查看此答案。

#1


1  

I cant find the Data-Files in the Storage!

我无法在存储中找到数据文件!

The file is stored in what the Android SDK refers to as internal storage. You can access this using the Device File Explorer in Android Studio, but only for debuggable apps.

该文件存储在Android SDK所指的内部存储中。您可以使用Android Studio中的设备文件资源管理器访问它,但仅适用于可调试应用程序。

In the Internal Storage, in storage/Android/data/ my package name is not there

在内部存储中,在存储/ Android / data /我的包名称不存在

That is what the Android SDK refers to as external storage.

这就是Android SDK所指的外部存储。

#2


0  

If you search with an file explorer on your app you wont be able to find it, because your files are private. Have a look at the documentation:

如果您在应用上使用文件浏览器进行搜索,则无法找到它,因为您的文件是私有的。看看文档:

Files saved here are accessible by only your app

此处保存的文件只能由您的应用访问

If you want the files to be public have a look at this section. Then you should use getExternalStoragePublicDirectory() instead of getFilesDir(). If you want your files to be on internal storage and public look at this answer.

如果您希望文件公开,请查看此部分。然后你应该使用getExternalStoragePublicDirectory()而不是getFilesDir()。如果您希望您的文件位于内部存储和公共内容,请查看此答案。