12

is there any solution how to choose the saving files location? maybe with the original file browser, to choose the destination?

thank you!

Swati Garg
  • 995
  • 1
  • 10
  • 21
David
  • 2,331
  • 4
  • 29
  • 42
  • Do you want to save a file using your app? – Maxim Aug 07 '12 at 14:33
  • yes, it's record a video and after the stop button(maybe before) wwant the choose where to save it – David Aug 07 '12 at 14:33
  • I think you should look at the internal/external storage on this page : http://developer.android.com/guide/topics/data/data-storage.html – Vince Aug 07 '12 at 14:37
  • possible duplicate of [Choose File Dialog](http://stackoverflow.com/questions/3592717/choose-file-dialog) – mmmmmm Apr 29 '13 at 11:40

3 Answers3

9

All you need is Android Directory Picker

Basbous
  • 3,927
  • 4
  • 34
  • 62
3

Better to save files with your app namespace:

String extStorage = Environment.getExternalStorageState();
path = extStorage+"/Android/data/com.mydomain.myapp/";

It will be deleted when app gets uninstalled.

Here is actually everything about data storing.
http://developer.android.com/guide/topics/data/data-storage.html

From the above link:

If you're using API Level 7 or lower, use getExternalStorageDirectory(), to open a File representing the root of the external storage. You should then write your data in the following directory:

/Android/data/<package_name>/files/
Nikola K.
  • 7,093
  • 13
  • 31
  • 39
Maxim
  • 4,152
  • 8
  • 50
  • 77
  • i know how to save it it works (mediaRecorder.setOutputFile("/sdcard/Festivale.mp4");) but want the choose the directory – David Aug 07 '12 at 14:37
0

It's probably easiest and expected to save this out to the dedicated area on the external SD card.

You can get this folder by calling

file://localhost/Applications/android-sdk-macosx/docs/reference/android/os/Environment.html#getExternalStoragePublicDirectory(java.lang.String)

File path = Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES)

You can also append a sub-folder to reference the source better ie. your app.

You can either choose DIRECTORY_PICTURES or DIRECTORY_MOVIES. If it's user created I'd probably stick to pictures.

To be helpful you can also call the media scanner to add it to the appropriate content provider system wide.

sendBroadcast( new Intent(Intent.ACTION_MEDIA_MOUNTED, 
                    Uri.parse("file://" + Environment.getExternalStorageDirectory()))
        );

If you MUST get a file chooser going, which isn't the recomened approach to expose the user to the file system. Try the file chooser form Open Intents. http://www.openintents.org/en/node/164

Pork 'n' Bunny
  • 6,740
  • 5
  • 25
  • 32
  • alright, so no theres no way to make something like save file dialog or somthing: – David Aug 07 '12 at 14:39
  • edit, added reference to open intents file chooser. Although this will prompt the user to download the file chooser, but its pretty streamlined last time I was exposed to it http://www.openintents.org/en/node/164 – Pork 'n' Bunny Aug 07 '12 at 14:42
  • There are more `Environment` constants - [`Environment.DIRECTORY_DOWNLOADS`](http://developer.android.com/reference/android/os/Environment.html#DIRECTORY_DOWNLOADS), for example. – naXa stands with Ukraine Jun 08 '14 at 10:42