Example usage for android.content Intent ACTION_GET_CONTENT

List of usage examples for android.content Intent ACTION_GET_CONTENT

Introduction

In this page you can find the example usage for android.content Intent ACTION_GET_CONTENT.

Prototype

String ACTION_GET_CONTENT

To view the source code for android.content Intent ACTION_GET_CONTENT.

Click Source Link

Document

Activity Action: Allow the user to select a particular kind of data and return it.

Usage

From source file:Main.java

public static Intent pickImage(int PICK_IMAGE) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    return Intent.createChooser(intent, "Select Picture");
}

From source file:Main.java

public static void startSelectLocalPhotoActivity(Activity activity, int requestCode) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void pickImageFromAlbum(final Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:Main.java

public static void takePhotoFromAbnum(Activity activity) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    intent.setType("image/*");
    activity.startActivityForResult(intent, TAKE_PHOTO_FROM_ALBUM);
}

From source file:Main.java

public static Intent getSelectSystemImageIntent() {
    Intent intent = null;/*ww w  . j  a v  a2 s .  c  o  m*/
    if (Build.VERSION.SDK_INT < 19) {
        intent = new Intent();
        intent.setAction(Intent.ACTION_GET_CONTENT);
    }
    // else {
    //            intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    //            intent.addCategory(Intent.CATEGORY_OPENABLE);
    //        }
    return intent;
}

From source file:Main.java

public static void openAlbum(Activity activity, int requestCode) {
    Intent intent;/*from w w  w .ja va2  s .co  m*/
    if (Build.VERSION.SDK_INT < 19) {
        intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("image/*");

    } else {
        intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    }
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openImageAction(Activity activity, int requestCode) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openAlbum(Activity activity) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    activity.startActivityForResult(intent, PICK_IMAGE_ACTIVITY_REQUEST_CODE);
}

From source file:Main.java

public static void FindPhoto(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");

    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:Main.java

public static void choosePicFromGalley(Context context) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);//ACTION_OPEN_DOCUMENT
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image/jpeg");

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        ((Activity) context).startActivityForResult(intent, CHOOSE_GALLERY);
    } else {//w  ww. jav a  2 s  .  com
        ((Activity) context).startActivityForResult(intent, CHOOSE_GALLERY);
    }
}