start Photo Zoom - Android Camera

Android examples for Camera:Photo

Description

start Photo Zoom

Demo Code


//package com.java2s;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

import android.net.Uri;

import android.util.DisplayMetrics;

public class Main {
    public final static int CROP_PICCODE = 102;

    public static void startPhotoZoom(Context context, Uri uri) {
        Intent intent = new Intent("com.android.camera.action.CROP");
        intent.setDataAndType(uri, "image/*");
        intent.putExtra("crop", "true");
        DisplayMetrics dm = new DisplayMetrics();
        dm = context.getResources().getDisplayMetrics();
        int screenWidth = dm.widthPixels; // 480px  
        int screenHeight = dm.heightPixels; // 800px  
        intent.putExtra("outputX", screenWidth * 3);
        intent.putExtra("outputY", screenHeight * 3);
        intent.putExtra("noFaceDetection", true); //
        intent.putExtra("return-data", true); //
        ((Activity) context).startActivityForResult(intent, CROP_PICCODE);
    }//from  w ww  .j av a 2s .co  m
}

Related Tutorials