Create pick Photo Intent - Android Intent

Android examples for Intent:Picture Pickup

Description

Create pick Photo Intent

Demo Code


import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;

public class Main{
    //from   w  w  w. j a  v a  2s .co  m
    public static final int REQUEST_CODE_PICK_PHOTO = REQUEST_CODE_TAKE_PHOTO + 3;
    public static void pickPhoto(Activity activity) {
        Intent intent = pickPhotoIntent();
        activity.startActivityForResult(intent, REQUEST_CODE_PICK_PHOTO);
    }
    
    public static void pickPhoto(android.support.v4.app.Fragment fragment) {
        Intent intent = pickPhotoIntent();
        fragment.startActivityForResult(intent, REQUEST_CODE_PICK_PHOTO);
    }
    private static Intent pickPhotoIntent() {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("image/*");
        return intent;
    }
}

Related Tutorials