Starts a file chooser Intent. - Android Intent

Android examples for Intent:Open File

Description

Starts a file chooser Intent.

Demo Code

import android.app.Activity;
import android.content.Intent;

public class Main {
  /**/*from ww w .  j  av a2 s  .  co m*/
   * Starts a file chooser.
   *
   * @param activity
   *          the Activity that requests the file choose.
   * @param requestCode
   *          request code for getting file.
   */
  public static void startFileChoosed(Activity activity, int requestCode) {
    Intent fileChooserIntent = new Intent(Intent.ACTION_GET_CONTENT);
    fileChooserIntent.setType("file/*");
    activity.startActivityForResult(fileChooserIntent, requestCode);
  }
}

Related Tutorials