title: open file in file manager android
body: <p>I saw many similar question, but no one help me! </p>
  
  <p>So, I want to get list of available file managers, and when user pick ones, open folder in this file manager, where necessary file located. File can be any extension.</p>
  
  <p>I try like this:</p>
  
  <pre><code>s=Uri.fromFile(File object);
  
  ...
  
  Intent intent = new Intent();
  intent.addCategory(Intent.CATEGORY_OPENABLE);
  intent.setType("file/*");
  intent.setAction(Intent.ACTION_GET_CONTENT);  
  intent.setData(s);
  context.startActivity(intent);
  </code></pre>
  
  <p>.. but this throw ActivityNotFoundException.</p>
  
  <p>Please, help me. Thanks!</p>
  
  <p>I call <code>StartActivity</code> from <code>DialogInterface.OnClickListener</code>, I have function, wich create dialog and return. One more point, when I don't <code>setData</code>, programm is working and give list of file manager to user, but it's open root directory, not directory of file.</p>
  
  <pre><code>private  Dialog createAlertDialog( final Context context,   final Uri s) {
          Dialog dialog = new Dialog(context);
          Builder builder = new AlertDialog.Builder(context);
  
          DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialogArg, int which) {
  
                  Intent intent = new Intent();
                  intent.addCategory(Intent.CATEGORY_OPENABLE);
                  intent.setType("file/*");
                  intent.setAction(Intent.ACTION_GET_CONTENT);  
                  intent.setData(s);
                  context.startActivity(intent);
              }
          };
          DialogInterface.OnClickListener onCloseDialog = new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialogArg, int which) {
  
                  }
          };
  
          dialog = builder.setPositiveButton(MyApp.getCustomAppContext().getString(R.string.ok), onClickListener)
                          .setNegativeButton(MyApp.getCustomAppContext().getString(R.string.cancel), onCloseDialog)
                          .setMessage(MyApp.getCustomAppContext().getString(R.string.open_explorer))
                          .create();
          return dialog;
      }
  </code></pre>
  
  <p>And in Log I have this:</p>
  
  <pre><code>09-13 11:06:47.226: ERROR/AndroidRuntime(14534): android.content.ActivityNotFoundException: No Activity found to 
   handle Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] 
    dat=file:///toptoptop/Noize%20MC%20Bring-Bring-Bring.mp4 }
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.app.Instrumentation.checkStartActivityResult
  (Instrumentation.java:1409)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.app.Instrumentation.execStartActivity
  (Instrumentation.java:1379)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.app.Activity.startActivityForResult
  (Activity.java:2827)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.app.Activity.startActivity(Activity.java:2933)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at com.serbinvitaly.copyeraser.ResultsActivity$4.onClick
  (ResultsActivity.java:171)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.os.Looper.loop(Looper.java:123)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at android.app.ActivityThread.main(ActivityThread.java:3687)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at java.lang.reflect.Method.invoke(Method.java:507)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
  09-13 11:06:47.226: ERROR/AndroidRuntime(14534):     at dalvik.system.NativeStart.main(Native Method)
  09-13 11:06:47.226: WARN/ActivityManager(7260):   Force finishing activity com.serbinvitaly.copyeraser/.ResultsActivity
  09-13 11:06:47.230: ERROR/(7260): Dumpstate &gt; /data/log/dumpstate_app_error
  </code></pre>