안드로이드 타블렛에서 자르기를 시도하고 있지만 작동하지 않습니다. 여기자르지 않고 이미지가 보이지 않고 작동하지 않습니다 - android
private void doCrop(){
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(mImageCaptureUri, "image/*");
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, 0);
int size = list.size();
if (size == 0) {
Toast.makeText(this, "Can not find image crop app", Toast.LENGTH_SHORT).show();
return;
} else {
intent.setData(mImageCaptureUri);
intent.putExtra("outputX", 648);
intent.putExtra("outputY", 486);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
if (size == 1) {
Intent i = new Intent(intent);
ResolveInfo res = list.get(0);
i.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
startActivityForResult(i, CROP_RESULT);
} else {
}
}
}
는 "카메라"를 요청하는 내 대화 또는 "
나는 넥서스 10
은 음 ... 여기 내 자르기위한 코드 사용하고 갤러리 "
private void startDialog() {
AlertDialog.Builder myAlertDialog = new AlertDialog.Builder(this);
myAlertDialog.setTitle("Selecione uma foto!");
myAlertDialog.setMessage("Choose a source");
myAlertDialog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
pictureActionIntent = new Intent(Intent.ACTION_GET_CONTENT, null);
pictureActionIntent.setType("image/*");
pictureActionIntent.putExtra("return-data", true);
startActivityForResult(pictureActionIntent, GALLERY_PICTURE);
}
});
myAlertDialog.setNegativeButton("Camera", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
pictureActionIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
storagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmp/android.jpg";
pictureActionIntent.putExtra(MediaStore.EXTRA_OUTPUT, storagePath);
startActivityForResult(pictureActionIntent, CAMERA_PICTURE);
}
});
myAlertDialog.show();
}
다음
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap bmp;
if (resultCode == RESULT_OK){
switch (requestCode){
case GALLERY_PICTURE :
mImageCaptureUri = data.getData();
doCrop();
break;
case CROP_RESULT :
Bundle extras = data.getExtras();
if (extras != null) {
bmp = extras.getParcelable("data");
bmp = Bitmap.createScaledBitmap(bmp, 648, 486, true);
Drawable d = new BitmapDrawable(getResources(),bmp);
btnTitular.setCompoundDrawablesWithIntrinsicBounds(null, d, null, null);
}
File f = new File(mImageCaptureUri.getPath());
if (f.exists()) f.delete();
Intent inten3 = new Intent(this, CadTitularActivity.class);
startActivity(inten3);
break;
case CAMERA_PICTURE :
doCrop();
break;
}
}
}
것은 무슨 일입니다 : D 여기 내 onActivityResult를하다 내가 갤러리에서 이미지를 잡아 때, 작물
쇼는하지만 작물에 "확인"에 클릭 할 때 이미지, 아무것도하지 않습니다.
카메라에서 사진을 가져올 때 아무런 효과가 없습니다. 그냥 "그림로드 중"을 보여 주며 아무 일도 일어나지 않습니다.
아이디어가 있습니까?
기억해 : Nexus 10을 사용하고 있습니다. 이미이 기기가 모든 기기에서 작동하지 않는다고 들었습니다.
도움이되었습니다.
감사합니다.