Android调用相机相册选图时怎么跳过裁剪
publicvoidstartPhotoZoom(Uriuri){System.out.println("uri="+uri);Intentintent=newInten...
public void startPhotoZoom(Uri uri) {
System.out.println("uri="+uri);
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, IMAGE_UNSPECIFIED);
intent.putExtra("crop", "true");
// aspectX aspectY 是宽高的比例
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1.5);
// outputX outputY 是裁剪图片宽高
intent.putExtra("outputX", 140);
intent.putExtra("outputY", 180);
intent.putExtra("return-data", true);
startActivityForResult(intent, PHOTORESOULT);
}
这个方法是调用系统裁剪,请问下有没有办法修改intent里的参数然后跳过调用系统裁剪? 展开
System.out.println("uri="+uri);
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, IMAGE_UNSPECIFIED);
intent.putExtra("crop", "true");
// aspectX aspectY 是宽高的比例
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1.5);
// outputX outputY 是裁剪图片宽高
intent.putExtra("outputX", 140);
intent.putExtra("outputY", 180);
intent.putExtra("return-data", true);
startActivityForResult(intent, PHOTORESOULT);
}
这个方法是调用系统裁剪,请问下有没有办法修改intent里的参数然后跳过调用系统裁剪? 展开
2个回答
展开全部
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, PICK);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case PICK:
String picPath = null;
String[] pojo = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(data.getData(), pojo, null, null,
null);
if (cursor != null) {
int columnIndex = cursor.getColumnIndexOrThrow(pojo[0]);
cursor.moveToFirst();
picPath = cursor.getString(columnIndex);
try {
if (Integer.parseInt(Build.VERSION.SDK) < 14) {
cursor.close();
}
} catch (Exception e) {
Log.e("", "error:" + e);
}
}
Log.i("", "imagePath = " + picPath);
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, PICK);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case PICK:
String picPath = null;
String[] pojo = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(data.getData(), pojo, null, null,
null);
if (cursor != null) {
int columnIndex = cursor.getColumnIndexOrThrow(pojo[0]);
cursor.moveToFirst();
picPath = cursor.getString(columnIndex);
try {
if (Integer.parseInt(Build.VERSION.SDK) < 14) {
cursor.close();
}
} catch (Exception e) {
Log.e("", "error:" + e);
}
}
Log.i("", "imagePath = " + picPath);
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询