Questions tagged [android-file]

Specifically the Android `File` class, but may also refer to the generic concept of files under the Android operating system

Specifically the Android File class, but may also refer to the generic concept of files under the Android operating system.

Use this tag if you have reason to believe your usage of files under Android causes the error your question is referring to.

1038 questions
40
votes
7 answers

Simple mediaplayer play mp3 from file path?

I have a very simple mediaplayer that play background. It calls file from the apk, but I want it to play from any directory like as music or sdcard. Here is my code: private MediaPlayer mpintro; . . mpintro = MediaPlayer.create(this,…
John simit
  • 1,305
  • 2
  • 11
  • 14
31
votes
6 answers

Android, how do can I get a list of all files in a folder?

I need the name (String) of all files in res/raw/ I tried: File f = new File("/"); String[] someFiles = f.list(); It looks like the root directory is the root of the android emulator...and not my computers root directory. That makes enough sense,…
jasonsemko
  • 743
  • 1
  • 7
  • 17
29
votes
4 answers

Android - How to get selected file name from the document

I am launching the intent for selecting documnets using following code. private void showFileChooser() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); try…
AndroidDev
  • 1,191
  • 3
  • 16
  • 35
25
votes
11 answers

java.io.filenotfoundexception open failed eacces (permission denied) on device

The following code which consists of downloading a file from a server and save it in the storage works fine when the device has an internal storage. But when I tried it with a device with no internal storage, only with external storage I get the…
Lazy Ninja
  • 22,342
  • 9
  • 83
  • 103
23
votes
6 answers

Save Bitmap in Android as JPEG in External Storage in a folder

I am using this code to save Bitmap in External Storage but it does not create the folder if it not exists: String path = Environment.getExternalStorageDirectory().toString(); OutputStream fOutputStream = null; File file = new…
aman.nepid
  • 2,864
  • 8
  • 40
  • 48
22
votes
6 answers

How to Copy Image File from Gallery to another folder programmatically in Android

I want to pick image from gallery and copy it in to other folder in SDCard. Code to Pick Image from Gallery Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); …
20
votes
4 answers

Copy files from a folder of SD card into another folder of SD card

Is it possible to copy a folder present in sdcard to another folder present the same sdcard programmatically ?? If so, how to do that?
Siva Kumar
  • 893
  • 4
  • 14
  • 28
20
votes
8 answers

How to get the internal and external sdcard path in android

Most of the new android devices have an internal sdcard and an external sdcard. I want to make a file explorer app but I can't find out how to get the path to use in my app because File file = Environment.getExternalStorageDirectory(); just…
Mahmoud Jorban
  • 952
  • 4
  • 13
  • 25
19
votes
5 answers

Using Dropbox API to upload a file with Android

How can I upload a File (graphic, audio and video file) with Android using the Dropbox API to Dropbox? I followed the tutorial on the Dropbox SDK Android page and could get the sample to work. But now instead of a String I want to upload an actual…
Dominik
  • 1,703
  • 6
  • 26
  • 46
19
votes
4 answers

how to create a file with world readable permission under subdirectory of files directory

I need to create files under myapp/files/subdir with global permission in my application. I do this because I use external applications to open some files Using this FileOutputStream fos = openFileOutput(FILENAME,…
ikbal
  • 1,844
  • 4
  • 26
  • 46
16
votes
11 answers

Missing android.support.FILE_PROVIDER_PATHS meta-data

I am trying to open the pdf file which I downloaded & saved in external storage. But When I open my app its gets crashed and showing following error; 08-31 00:58:31.304 1807-1807/? E/AndroidRuntime: FATAL EXCEPTION: main Process:…
priyanka kamthe
  • 519
  • 2
  • 5
  • 19
16
votes
2 answers

Android 5(HTC) EACCES (Permission denied)

app can't create folder/file on android 5(HTC HTC6525LVW os version: 5.0.1) external storage in directory owned by app. Parent folder is returned by [getExternalFilesDirs(String type)][1] method. Sdcard is mounted. Anyone else having this problem…
15
votes
1 answer

Allow User To Select Path For Save File in Android

I am developing one application for our client and there is one little functionality where we are stuck, so need your help, Scenarion: We have developed one recycle view, from where users can see list of images and songs and videos as per category,…
Vickyexpert
  • 3,147
  • 5
  • 21
  • 34
15
votes
2 answers

Android: Open file with intent chooser from URI obtained by Storage Access Framework

In the beginning the user can select files with the new Storage Access Framework (Assuming the app is API>19): https://developer.android.com/guide/topics/providers/document-provider.html Then I save references to those chosen files by saving the…
14
votes
3 answers

Downloaded files get deleted automatically

In my app, there are a few files that users can download. The files get downloaded via the android download manager. But, since a few weeks now, hundreds of users have been complaining that their files automatically keep deleting every 8-12 days,…
Sagar
  • 3,107
  • 2
  • 26
  • 35
1
2
3
69 70