How to open the My Files folder in Android programmatically (using Intent)?

I use the code below that opens the gallery, music player, Dropbox and contacts, I want the My Files folder to open programmatically, let me know if there are any specific intent settings that I need to pass in order to get the File Manager opens.

if this is not possible with intent, please give me a snippet or a hint to open the My Files folder programmatically.

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); Intent i = Intent.createChooser(intent, "View Default File Manager"); startActivityForResult(i, CHOOSE_FILE_REQUESTCODE); 

Thanks.

+4
source share
6 answers

You can use this code for the file.

 int PICKFILE_RESULT_CODE=1; Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("file/*"); startActivityForResult(intent,PICKFILE_RESULT_CODE); 

this will help you browse files from your vault.

+3
source

Bad, most Android distributions may or may not come with a file manager, and even so may not be the one that handles CHOOSE_FILE_REQUESTCODE .

So, you just have to create your own file selection operation. Fortunately, many finished products are available:

http://code.google.com/p/android-filechooser/

https://developers.inkfilepicker.com/docs/android/

+1
source

try this code below. if any file manager is available, it will appear as a menu to select the one suitable for the user.

 Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("file/*"); startActivityForResult(intent, CHOOSE_FILE_REQUESTCODE); 
+1
source

If you want to open the Samsung My Files app, try this code below.

 Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA"); intent.putExtra("CONTENT_TYPE", "*/*"); startActivityForResult(intent, CHOOSE_FILE_REQUESTCODE); 
+1
source

It is best for you to include the library in your project that processes this script.

It helped me:

This library displays a list of third-party applications. It also has its own file browser for selecting files.

+1
source

You must specify the package name of the explorer application. Below is an example below to open a specific folder in ES Explorer.

  public void openfolderInexplorer(String path){ Intent intent = this.getPackageManager().getLaunchIntentForPackage("com.estrongs.android.pop"); if (intent != null) { // If the application is avilable intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.parse(path); intent.setDataAndType(uri, "resource/folder"); this.startActivity(intent); } else { // Play store to install app intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id=" + "com.estrongs.android.pop")); this.startActivity(intent); } 
0
source

Source: https://habr.com/ru/post/1495688/


All Articles