Search code examples
androidinternal-storage

Can anyone tell me about InternalStorage in Android ? I am confused


I am new to android . I have little confusion on internal storage topic in android. Please correct me if i am worng

InternalStorage :- Allows us to read and write file that are associated with each application's internal memory so the data are private to your app. This file can only be accessed by the application and cannot be accessed by other application or users

Is it true that InternalStorage store data in device internal memory ? If answer is yes then how can i store images ,videos etc that user can see and access it on device or by pc when they are connected through usb?

if my app downloads an image and device does not have sdcard and i have used internalstorage method in this condition how user can see dowloaded image using usb or from device ?

It will be good if explanation is given with example .Thanks in advance


Solution

  • You must save your files on external storage. Notice that external storage does not automatically mean removable storage. Normally the devices built-in storage is divided into internal and external storage. However, external storage also includes removable storage like SD cards.

    So, if you want to save files that the user should be able to access for example with his PC you should save to the external storage.

    The respective user guides on that topic are in particular:

    For example, if you want to save a picture that is accessible by the user in the expected directory you would use

    File picture = new File(Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES), "filename.png");