open Gallery via Intent - Android android.content

Android examples for android.content:Intent

Description

open Gallery via Intent

Demo Code

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;

public class Main{

    public static void openGallery(Activity activity, int requestCode) {
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        activity.startActivityForResult(intent, requestCode);
    }/* w ww .  j a v  a2  s  .co  m*/

}

Related Tutorials