Samsung My Files explorer: Pick file from specified folder
Asked Answered
K

1

6

I'm using the following code to open Samsung's My Files application to pick a file...

  public void openFileBrowser( ) {
        Intent intent = new Intent( "com.sec.android.app.myfiles.PICK_DATA" );
        try {
            startActivityForResult( intent, PICKFILE_RESULT_CODE );
        } catch ( ActivityNotFoundException e ) { 
            e.printStackTrace( );
            Log.log( Log.ERROR, TAG + "MyFiles is not installed !!" );
        }
    }   

this opens My Files application and lets user choose a file through it.
However, I wish to open a particular folder on device's external memory... and let user choose a file from there.... I tried achieving this by doing...

 public void openFileBrowser( ) {
        Intent intent = new Intent( "com.sec.android.app.myfiles.PICK_DATA" );
        File root = new File( Environment.getExternalStorageDirectory( ).getPath( ) + "/MyFolder" );
        Uri uri = Uri.fromFile( root ); 
        intent.setData( uri );        
        try {
            startActivityForResult( intent, PICKFILE_RESULT_CODE );
        } catch ( ActivityNotFoundException e ) {
            e.printStackTrace( );
            Log.log( Log.ERROR, TAG + "MyFiles is not installed !!" );
        }
    }    

But I get an exception as :

 W/System.err(14682): android.content.ActivityNotFoundException: No Activity found to    handle Intent { act=com.sec.android.app.myfiles.PICK_DATA dat=file:///storage   /emulated/0/MyFolder }    

Can someone please help me with this?
Thank you!

Kath answered 12/2, 2014 at 7:43 Comment(2)
Hi @Kath did you find any solution >?Chiseler
@Chiseler did you get any solution, if yes please post here.Cenotaph
C
0

You can set specify the startlocation in samsung Intent by specifying the FOLDERPATH like below.

intent.putExtra("FOLDERPATH", path);   
Cenotaph answered 27/3, 2018 at 9:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.