Pergunta

I am trying to make a button that when on click will change the view and open up the native file explorer on a tablet. I found a potential solution with code like this:

fileBrowseButton.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            PackageManager packageManager = getPackageManager();
            startActivity(packageManager.getLaunchIntentForPackage("com.My Files.android"));
        }
    });

The only issue I seem to have is I can't identify the name of the package that is the file explorer, I tried looking around in the app manager. I know on my Motorola phone its:

com.motorola.filemanager

Anyone know what the package name?

The possible workaround is downloading something like Astro and using that instead, but I would prefer the native app first.

Foi útil?

Solução

I did some apk digging and found the package name for my device...

Now I know this will not work on other devices, I tested it on Motorola device and got an error (which was expected).

The package name for Samsung Galaxy Tab 2 native file browser turned out to work with the name:

"com.sec.android.app.myfiles"

Thanks

Outras dicas

Android does not have a native File Manager, though most OEMs usually install one of their own, or one of a developer with whom they have an agreement.

You should either use an Intent to pick the file, and maybe even provide a small file manager yourself. This answer here should help with that.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top