Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;
import android.content.Intent;

import android.provider.MediaStore;

public class Main {
    private static final int PHOTO_REQUEST_GALLERY = 2;

    public static void chooseImg(Activity activity) {
        Intent pickIntent = new Intent(Intent.ACTION_PICK, null);
        pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
        activity.startActivityForResult(pickIntent, PHOTO_REQUEST_GALLERY);
    }
}