[Q]Intent to launch a file manager - Android Software Development

I've been banging my head on this, but can't seem to get it to work.
I'm trying to launch a file manager from my app. Here's the code I'm using.. I think (thought) it was correct, but I'm missing something. I want it to pop up a list of available file managers to open to that path.
Code:
Url = "file:///sdcard/";
Intent fileMangerIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Url));
startActivity(fileMangerIntent);
Thanks.
Edit: I've tried just passing /sdcard as the path, and also with and without the trailing slash. I've tried with an http url and it works as intended.

try using ACTION_CHOOSER, it should display all the activities on the phone that can handle that type of URI. http://developer.android.com/reference/android/content/Intent.html#ACTION_CHOOSER

Thanks.. I'll try that..

Doesn't seem to do what I'm trying to get it to do. If I specify a file and a mimetype (ie. a jpeg), then it works to popup a list of apps to view the file.
And with AndExplorer, I can have it popup as a file chooser or directory chooser.
But what i'm trying to is just launch a file explorer at the given path. Don't need any information back.
What I'm working on is an app that lists all attached usb drives (on HC Tablets) and allows mounting/unmounting any/all devices of ext, fat, ntfs. And I want to be able to click the mount points in my app to switch to a file explorer to browse the files.
But it doesn't seem like any of the file managers handle that. I might have to build in a minimal file manager.

If the file browsers you are trying to incorporate into your app dont support an entry point that takes you straight to a directory then it'll be hard to make this work. I guess the best you can do is look at the published intents and see if there is a way to pass a directory.
From something awesome

Related

[Q] Hide From Gallery

I have created a folder on my external sd card named Movies.
I use Moboplayer, and have pre-set it to only view that folder when opened. But, after viewing any of the files in the sd card folder, the folder and files are displayed in Gallery. How can I prevent that from happening?
Or, put another way, I want to store some video files on my external sd card
and want to be the only one who is able to view them?
create a file in that directory called .nomedia that will prevent it being scanned by Gallery
Thanks, I'll try that later today and report back.
gunnyman said:
create a file in that directory called .nomedia that will prevent it being scanned by Gallery
Click to expand...
Click to collapse
As a beginner with Android, I'm not sure I know how to do what you said to do.
Can you please tell me the easiest way to create that file? Thanks again.
Sure. Open an adb shell. Change to the directory you want the file in. Type "touch .nomedia "
Press enter
Sent from my Desire HD using XDA Premium App
As an Android beginner, I have no idea what or how to use and adb shell.
Does it require that the Tab be Rooted?
Can I use a file manager like Astro?
Can I open the folder on my win xp desktop and create the file om the sd card with windows explorer?
Sorry to be so dense here, but, I am trying to learn what to do.
jostarr said:
As an Android beginner, I have no idea what or how to use and adb shell.
Does it require that the Tab be Rooted?
Can I use a file manager like Astro?
Can I open the folder on my win xp desktop and create the file om the sd card with windows explorer?
Sorry to be so dense here, but, I am trying to learn what to do.
Click to expand...
Click to collapse
Get the free ES File Explorer from the store. You can do all the MS Windows-esque file management with that.
What is going to prevent someone else from launching Mobo and seeing the same files that you do?
I do have ES File Explorer installed, and didn't find a way to create a new file in that folder. Can you please suggest what to do when I get to the folder in question? Thanks.
As for your question about others using Mobo, is there a way to password protect a give app?
jostarr said:
I do have ES File Explorer installed, and didn't find a way to create a new file in that folder. Can you please suggest what to do when I get to the folder in question? Thanks.
As for your question about others using Mobo, is there a way to password protect a give app?
Click to expand...
Click to collapse
Ok, es 101: the key to finding everything is the menu button that spears on the dock in es. From there you can select new> folder.
android/linux 101: any file or folder named starting with a period is deemed "hidden". An example would be a folder called .media. Because the name behind with a period, it is now hidden. To show hidden file, go into es file explorer settings, and check "show hidden files"
...and if you don't want to play with renaming folders every time, try Hide It Pro from the market. You set a password that is required to open the app. It disguise itself as a fake audio manager. You just need to browse to the file you need to hide and select "share with audio manager". There's a really good guide inside the app when you install it but its rather simple Works great on Iconia.
https://market.android.com/details?id=com.smartanuj.hideitpro&feature=search_result
It also displays adds but its free and your hidden content is just a "click" away You can hide any file type compared to Photo Vault and Video Vault (they support only several file formats and they are paid apps)
Use a file manager such as astro, and change the format of the video to a format that doesn't exist by renaming it, for example: video.avi ----> video.uitpo, then the video won't be shown in gallery or anywhere else, and whenever you wanna view the video just change the format back to what it was.
gunnyman said:
create a file in that directory called .nomedia that will prevent it being scanned by Gallery
Click to expand...
Click to collapse
I have created a file in my directory named .nomedia
But, when the Acer is powered off and started up again, all the files in this directory show up in the Gallery again. That approach doesn't seem to work for me.

[Q] Editing the file types that the Library app catalogs...

Is there anyway to change the group of file types that are listed in the native Library app? I'd like to add CBR/CBZ to the Library listing; I use ComiCat to read these files now and obviously would continue using that app but I'd like to just list all my books/comics in one place. My assumption would be if I was able to list this, the android system would ask me what app I want to open the CBR file in and I'd choose ComiCat as the default application... I decrypted Library.apk and went through all the XML code but couldn't find anything useful.. Any ideas?

[Q] A storage question

This isn't necessarily a nexus question, but I thought you guys would probably know anyway.
If I look at the file structure over a USB cable from my PC, I see what I think is on the "SD card". I have a list of directories and I can see the files.
However, if I use ES File manager, I can go to /SDCARD0 and I see the same file list but an additional directory called "maps" (created by my mind map application).
if I use ES File manager and just look at where it starts off (the Home directory), I don't see that "maps" directory.
So, how can I get my PC to see that extra directory? Is it some sort of permissions or is it more complex than that?
regards
Alan

Trying to figure out directory structure bt-200

Hello I am trying to figure out how to write to file using the bt-200. I am using unity and c# to try and write an application for the glasses and I need to create and write to a txt file. I am using the line System.IO.File.WriteAllText (@"file.txt", data); to attempt this. What I cannot find is the proper path to use since I am unfamiliar with the devices directory structure. I have also tried to use path = System.IO.Directory.GetCurrentDirectory(); but this has not worked either and I cannot find the file I have supposedly generated. Any help would be appreciated.
Hi. There is a app on the bt-200 called "sev". Check the directory structure and your file with this app.
If your using windows, you should be aware that not every file is displayed, when you connect your bt-200 with your pc and use explore. Even if your are in the right folder.( That's why you need to recheck with sev)
The folder where you land, when you press explore in windows is "/mnt/sdcard"

Saving files to external storage, custom directory.

Hey all -
Have a question.
I want to call the Camera intent, but have the camera save to a custom file.
I've read this: https://developer.android.com/training/data-storage/files#WriteExternalStorage
And the only two options it gives is 'Save to a public directory" (like \Pictures, \Ringtones, etc), or "Save to a Provate Directory".
The latter sounds like it's what I want to do - but mentioned 'getExternalFilesDir()' function retrieves my application's custom data directory (which is (1)removed when the app is uninstalled, and (2)difficult to find when the phone is plugged into a computer - to copy the saved files from.)
What I'd REALLY wanna do is save my files to a root directory in the external storage. (Like, "/<sdcard mount path>/PicLogger/<file>").
Anyone know of a guide, or examples that show how to save images through the camera into a custom directory like this?
Thanks!
-Mike
You can save the file wherever you want, given that you have permission to write to SD card, by passing the file URI as MediaStore.EXTRA_OUTPUT in the MediaStore.ACTION_IMAGE_CAPTURE intent. See Save the full-size photo.
That being said, you should prefer something like "DCIM/YourAppName" or "Pictures/YourAppName", which apps like Google PhotoScan etc have been doing.
Code:
new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "YourAppName")
Apps should not create their own directories directly under the SD card root directory, and if they want to make something visible to user, it should be under one of the standard directories, preferrably under a subdirectory named after your app.
Or if you want to support scoped storage since Q, you can check out this SO answer.

Categories

Resources