Android Question Share file location to files or folder apps

Nokia

Active Member
Licensed User
Longtime User
Does anybody know how to share file location to File apps or My Files app on Samsung phones and tablets?

I want the user to be able to view one or more files in the in a file or folders app, so they can decide what they want to do with it after words..

B4X: Copy
Dim FileName As String = r(2)
            File.Copy(strDecDirLoc, FileName, Starter.Provider.SharedFolder, FileName)       
            
            Dim in As Intent
            in.Initialize(in.ACTION_VIEW, "")
            Starter.Provider.SetFileUriAsIntentData(in, FileName)
            'Type must be set after calling SetFileUriAsIntentData
            'in.SetType("*file/*")
            in.SetType("*/*")
            'in.SetType("application/*")
            StartActivity(in)

I don't have the files stored in the internal dir in the shared folder.. I have them stored in an external dir... not sure if this is the problem.. I have tried to change from internal dir to external and can not get it to work.. I have added my test app..
 

Attachments

Upvote 0


something like this:

Code: Copy
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent, YOUR_RESULT_CODE);

If you want to open a specific folder:

Code: Copy
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setDataAndType(Uri.parse(Environment.getExternalStorageDirectory().getPath()
 +  File.separator + "myFolder" + File.separator), "file/*");
startActivityForResult(intent, YOUR_RESULT_CODE);
 
Upvote 0
Back
Top