build Gallery Pick Intent - Android Intent

Android examples for Intent:System Gallery

Description

build Gallery Pick Intent

Demo Code


//package com.java2s;
import android.content.Intent;
import android.graphics.Bitmap;

import android.net.Uri;

public class Main {
    public static Intent buildGalleryPickIntent(Uri saveTo, int aspectX,
            int aspectY, int outputX, int outputY, boolean returnData) {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("image/*");
        intent.putExtra("crop", "true");
        intent.putExtra("output", saveTo);
        intent.putExtra("aspectX", aspectX);
        intent.putExtra("aspectY", aspectY);
        intent.putExtra("outputX", outputX);
        intent.putExtra("outputY", outputY);
        intent.putExtra("scale", true);
        intent.putExtra("return-data", returnData);
        intent.putExtra("outputFormat",
                Bitmap.CompressFormat.PNG.toString());
        return intent;
    }//  ww  w.  j  av  a2s .  c  om
}

Related Tutorials