You should use ContextWrapper like this:
ContextWrapper cw = new ContextWrapper(context);
File directory = cw.getDir("media", Context.MODE_PRIVATE);
As always, refer to documentation, ContextWrapper has a lot to offer.
More Related Contents:
- Android saving file to external storage
- Android create folders in Internal Memory
- Android: Save file permanently (even after clear data / uninstall)
- Downloadable files in my application
- Android Kotlin: Getting a FileNotFoundException with filename chosen from file picker?
- onActivityResult’s intent.getPath() doesn’t give me the correct filename
- How to programmatically move, copy and delete files and directories on SD?
- Choose File Dialog [closed]
- Android: Getting a file URI from a content URI?
- How to create a file in Android?
- Android; Check if file exists without creating a new one
- Creating a directory in /sdcard fails
- Convert Bitmap to File
- Pick any kind of file via an Intent in Android
- Android path to asset txt file
- Using NanoHTTPD in Android
- simple HttpURLConnection POST file multipart/form-data from android to google blobstore
- Register to be default app for custom file type
- How to upload file using Volley library in android?
- Can a videoview play a video stored on internal storage?
- how to serialize an object of android.graphics.Path
- Android SharedPreferences limitations?
- Android Programming: Where To Start For Creating A Simple File Browser?
- copy database file to sdcard in android
- Android open pdf file
- how to check internal and external storage if exist
- is there a maximum size to android internal storage allocated for an app?
- Speech to Text from own sound file
- Read video stored on android native storage in my Ionic app
- Creating app which opens a custom file extension