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

后端 未结 6 670
说谎
说谎 2020-12-28 22:30

I am using the below code which opens up the Gallery, Music Player, Dropbox and Contacts, i want the My Files folder to get open programatically, please let me know if there

相关标签:
6条回答
  • 2020-12-28 23:09

    If you want to open samsung My Files application try this below code.

    Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");              
    intent.putExtra("CONTENT_TYPE", "*/*");
    startActivityForResult(intent, CHOOSE_FILE_REQUESTCODE); 
    
    0 讨论(0)
  • 2020-12-28 23:10

    Its best that you include a library in your project which handles this scenario.

    This worked for me:

    This library shows the list of third-party apps. It also has its own file browser for selecting files.

    0 讨论(0)
  • 2020-12-28 23:14

    Bad thing is, most Android distributions may or may not ship with a file manager, and even so, may be not with the one which handles CHOOSE_FILE_REQUESTCODE.

    So, you are left to create your own file picker activity. Luckily there are many ready made ones available:

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

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

    0 讨论(0)
  • 2020-12-28 23:14

    You have to specifically mention the package name of the explorer application. Please find the 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 讨论(0)
  • 2020-12-28 23:19

    You can use this code to file the files.

    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 to browse the files from your storage.

    0 讨论(0)
  • 2020-12-28 23:24

    try this below code. if any file manager available , then it will pop up in a form of menu to choose appropriate for the user.

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("file/*");
    startActivityForResult(intent, CHOOSE_FILE_REQUESTCODE); 
    
    0 讨论(0)
提交回复
热议问题