start Photo Zoom - Android android.hardware

Android examples for android.hardware:Photo

Description

start Photo Zoom

Demo Code

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;
    int screenHeight = dm.heightPixels;
    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);
  }/*w  w  w  .jav a 2  s .co  m*/

}

Related Tutorials