Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of files of saved to the internal storage

Tags:

android

My android application is saving some stats to internal storage. Each file name is in the format of "appname-currentDate"

I was wondering:

  1. When I save to internal storage, is there a specific folder assigned to my app, or are my files saved along with files from other applications in the same directory.
  2. Is there a way to know the list of files saved by my application to the internal storage

Thank you so much.

like image 308
Snake Avatar asked Jun 28 '12 06:06

Snake


People also ask

What are internal storage files?

Internal storage is the storage of the private data on the device memory. By default these files are private and are accessed by only your application and get deleted , when user delete your application.

How do I list files in internal storage on Android?

Head to Settings > Storage > Other and you'll have a full list of all the files and folders on your internal storage. (If you'd prefer this file manager be more easily accessible, the Marshmallow File Manager app will add it as an icon to your home screen.)

How do I find files in my internal storage?

Managing files on your Android phone With Google's Android 8.0 Oreo release, meanwhile, the file manager lives in Android's Downloads app. All you have to do is open that app and select the "Show internal storage" option in its menu to browse through your phone's full internal storage.


3 Answers

1) Depends on which method you use to get the file handle. Normally files are stored in an application specific directory, eg. /data/data/[your.package.name]/. The files in that directory are only readable by your application.

2) Use the getFilesDir() method in your Activity to get a File handle and use the listFiles() on it to get an array of File representing all files in your application data folder.

Further reading: http://developer.android.com/guide/topics/data/data-storage.html

like image 104
Sebastian Avatar answered Oct 18 '22 18:10

Sebastian


1-When I save to internal storage, is there a specific folder assigned to my app, or are my files saved along with files from other applications in the same direcotry.

By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user).

And files are stored in /data/data/<package_name>/files directory. Particular for your application package.

2- Is there a way to know the list of files saved by my application to the internal storage.

use method getFilesDir()

Gets the absolute path to the filesystem directory where your internal files are saved.

For more information look at Android - Internal Storage

like image 35
user370305 Avatar answered Oct 18 '22 18:10

user370305


Your files will be saved in data/data/your.package.com this folder. your.package.com is your package name.

You can see that in ddms. If you use eclipse and run emulator or device you can see your files in eclipse -> ddms tab

enter image description here

like image 41
Nirali Avatar answered Oct 18 '22 16:10

Nirali