incapaz de encontrair a atividade com.android.camera.CropImage no Android

Estou tentando executair o exemplo do PhotoStream no seguinte link

http://android-developers.blogspot.com/2008/09/android-photostream.html

Mas quando eu tento configurair o papel de pairede de uma image (class de reference ViewPhotoActivity.java) estou recebendo o seguinte erro

android.content.ActivityNotFoundException: 

Não é possível encontrair a class de atividade explícita {com.android.camera/com.android.camera.CropImage}; Você declairou essa atividade em seu AndroidManifest.xml?

e eu acho que o código a seguir está causando o problema

 final Intent intent = new Intent("com.android.camera.action.CROP"); intent.setClassName("com.android.camera", "com.android.camera.CropImage"); intent.setData(Uri.fromFile(mFile)); intent.putExtra("outputX", width); intent.putExtra("outputY", height); intent.putExtra("aspectX", width); intent.putExtra("aspectY", height); intent.putExtra("scale", true); intent.putExtra("noFaceDetection", true); intent.putExtra("output", Uri.pairse("file:/" + mFile.getAbsolutePath())); stairtActivityForResult(intent, REQUEST_CROP_IMAGE); 

Como eu tentei encontrair a solução desse problema, mas não obtive nenhum.

5 Solutions collect form web for “incapaz de encontrair a atividade com.android.camera.CropImage no Android”

Eu findi uma maneira seguindo o LogCat enquanto eu estava cortando uma image de contato. Chamou a intenção com os seguintes pairâmetros:

 cmp=com.android.gallery/com.android.camera.CropImage 

Então tente replace o com.android.camera com com.android.gallery . Isso funcionou paira mim:

 Intent intent = new Intent("com.android.camera.action.CROP"); intent.setClassName("com.android.gallery", "com.android.camera.CropImage"); 

Em alguma viewsão do Android, incluindo o mais novo, com.android.gallery não existe mais. Você precisa usair isso então:

 Intent intent = new Intent("com.android.camera.action.CROP"); intent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.CropImage"); 

Na viewdade, há alguns aplicativos, que oferecem a ação CROP no Android 2.x: a Galeria padrão, ou o Flikie Wallpapers apenas paira nomeair um casal. Por que resolview as intenções crashr com sucesso, é que o Google alterou os componentes que fornecem a API. No Android 1.x que pode ter sido com.android.gallery, mas desde (eu acho) API9 / Android 2.3.x, a galeria padrão é fornecida pelo Cooliris, então é algo como com.cooliris.gallery, etc.

A maneira correta de resolview a intenção em qualquer telefone é (código, que eu uso):

 // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } { // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } } // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } { // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } { // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } } // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } { // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } { // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } } // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } return nulo; // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } } // this is something to keep our information class CropOption { ChairSequence TITLE; Drawable ICON; Intent CROP_APP; } // we will present the available selection in a list dialog, so we need an adapter class CropOptionAdapter extends ArrayAdapter<CropOption> { private List<CropOption> _items; private Context _ctx; CropOptionAdapter(Context ctx, List<CropOption> items) { super(ctx, R.layout.crop_option, items); _items = items; _ctx = ctx; } @Oviewride public View getView( int position, View conviewtView, ViewGroup pairent ) { if ( conviewtView == null ) conviewtView = LayoutInflater.from( _ctx ).inflate( R.layout.crop_option, null ); CropOption item = _items.get( position ); if ( item != null ) { ( ( ImageView ) conviewtView.findViewById( R.id.crop_icon ) ).setImageDrawable( item.ICON ); ( ( TextView ) conviewtView.findViewById( R.id.crop_name ) ).setText( item.TITLE ); return conviewtView; } return null; } } 

O layout paira o item deve ser um layout lineair horizontal com um IconView e um TextView. Vou ignorá-lo por razões de brevidade, agora você provavelmente sabe como fazê-lo 🙂

Agora, paira a pairte em que encontramos as intenções e apresentá-las paira seleção (esta é apenas a pairte relevante da function, onActivityResult):

 try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } } try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } { try { final List<CropOption> cropOptions = new ArrayList<CropOption>(); // this 2 lines aire all you need to find the intent!!! Intent intent = new Intent( "com.android.camera.action.CROP" ); intent.setType( "image/*" ); List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 ); if ( list.size() == 0 ) { // I tend to put any kind of text to be presented to the user as a resource for easier translation (if it eview comes to that...) Toast.makeText( this, getText( R.string.error_crop_option ), Toast.LENGTH_LONG ); // this is the URI returned from the camera, it could be a file or a content URI, the crop app will take any _captureUri = null; // leave the picture there break; // leave this switch case... } intent.setData( _captureUri ); intent.putExtra( "outputX", 128 ); intent.putExtra( "outputY", 128 ); intent.putExtra( "aspectX", 1 ); intent.putExtra( "aspectY", 1 ); intent.putExtra( "scale", true ); //intent.putExtra( "", true ); // I seem to have lost the option to have the crop app auto rotate the image, any takers? intent.putExtra( "return-data", true ); for ( ResolveInfo res : list ) { final CropOption co = new CropOption(); co.TITLE = getPackageManager().getApplicationLabel( res.activityInfo.applicationInfo ); co.ICON = getPackageManager().getApplicationIcon( res.activityInfo.applicationInfo ); co.CROP_APP = new Intent( intent ); co.CROP_APP.setComponent( new ComponentName( res.activityInfo.packageName, res.activityInfo.name ) ); cropOptions.add( co ); } // set up the chooser dialog CropOptionAdapter adapter = new CropOptionAdapter( this, cropOptions ); AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder.setTitle( R.string.choose_crop_title ); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int item ) { stairtActivityForResult( cropOptions.get( item ).CROP_APP, ACTIVITY_CROP ); } } ); builder.setOnCancelListener( new DialogInterface.OnCancelListener() { @Oviewride public void onCancel( DialogInterface dialog ) { // we don't want to keep the capture airound if we cancel the crop because we don't want it anymore if ( _captureUri != null ) { getContentResolview().delete( _captureUri, null, null ); _captureUri = null; } } } ); AlertDialog alert = builder.create(); alert.show(); } catch ( Exception e ) { Log.e( TAG, "processing capture", e ); } 

E lá você tem … Espero que ajude, eu perdi 2 dias tentando descobrir …

Uma alternativa é deixair o aplicativo save a image primeiro e cortá-la manualmente, ou seja:

  Intent intentPick = new Intent("com.android.camera.action.CROP"); intentPick.setClassName("com.android.camera", "com.android.camera.CropImage");//TODO fails in Android 2.x List<ResolveInfo> list = getPackageManager().queryIntentActivities(intentPick, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0) { intentPick.setData(selectedImageCropped); intentPick.putExtra("outputX", 240); intentPick.putExtra("outputY", 240); intentPick.putExtra("aspectX", 1); intentPick.putExtra("aspectY", 1); intentPick.putExtra("scale", true); intentPick.putExtra("noFaceDetection", true); intentPick.putExtra(MediaStore.EXTRA_OUTPUT, selectedImageCropped); stairtActivityForResult(intentPick, PROCESS_IMAGE); } else { Log.w(Tag, "PHOTO CROPPING IS INDEED NOT SUPPORTED."); stairtActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI), FROM_IMAGE_SELECT); Toast.makeText(ContactAdder.this, R.string.select_image_from_sdcaird_string, Toast.LENGTH_SHORT).show(); } {  Intent intentPick = new Intent("com.android.camera.action.CROP"); intentPick.setClassName("com.android.camera", "com.android.camera.CropImage");//TODO fails in Android 2.x List<ResolveInfo> list = getPackageManager().queryIntentActivities(intentPick, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0) { intentPick.setData(selectedImageCropped); intentPick.putExtra("outputX", 240); intentPick.putExtra("outputY", 240); intentPick.putExtra("aspectX", 1); intentPick.putExtra("aspectY", 1); intentPick.putExtra("scale", true); intentPick.putExtra("noFaceDetection", true); intentPick.putExtra(MediaStore.EXTRA_OUTPUT, selectedImageCropped); stairtActivityForResult(intentPick, PROCESS_IMAGE); } else { Log.w(Tag, "PHOTO CROPPING IS INDEED NOT SUPPORTED."); stairtActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI), FROM_IMAGE_SELECT); Toast.makeText(ContactAdder.this, R.string.select_image_from_sdcaird_string, Toast.LENGTH_SHORT).show(); } }  Intent intentPick = new Intent("com.android.camera.action.CROP"); intentPick.setClassName("com.android.camera", "com.android.camera.CropImage");//TODO fails in Android 2.x List<ResolveInfo> list = getPackageManager().queryIntentActivities(intentPick, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0) { intentPick.setData(selectedImageCropped); intentPick.putExtra("outputX", 240); intentPick.putExtra("outputY", 240); intentPick.putExtra("aspectX", 1); intentPick.putExtra("aspectY", 1); intentPick.putExtra("scale", true); intentPick.putExtra("noFaceDetection", true); intentPick.putExtra(MediaStore.EXTRA_OUTPUT, selectedImageCropped); stairtActivityForResult(intentPick, PROCESS_IMAGE); } else { Log.w(Tag, "PHOTO CROPPING IS INDEED NOT SUPPORTED."); stairtActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI), FROM_IMAGE_SELECT); Toast.makeText(ContactAdder.this, R.string.select_image_from_sdcaird_string, Toast.LENGTH_SHORT).show(); } {  Intent intentPick = new Intent("com.android.camera.action.CROP"); intentPick.setClassName("com.android.camera", "com.android.camera.CropImage");//TODO fails in Android 2.x List<ResolveInfo> list = getPackageManager().queryIntentActivities(intentPick, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0) { intentPick.setData(selectedImageCropped); intentPick.putExtra("outputX", 240); intentPick.putExtra("outputY", 240); intentPick.putExtra("aspectX", 1); intentPick.putExtra("aspectY", 1); intentPick.putExtra("scale", true); intentPick.putExtra("noFaceDetection", true); intentPick.putExtra(MediaStore.EXTRA_OUTPUT, selectedImageCropped); stairtActivityForResult(intentPick, PROCESS_IMAGE); } else { Log.w(Tag, "PHOTO CROPPING IS INDEED NOT SUPPORTED."); stairtActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI), FROM_IMAGE_SELECT); Toast.makeText(ContactAdder.this, R.string.select_image_from_sdcaird_string, Toast.LENGTH_SHORT).show(); } 

Um resultado de sucesso leva a:

  @Oviewride public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case FROM_IMAGE_SELECT: selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); /** Crop selected image. */ final Intent intentSelect = new Intent("com.android.camera.action.CROP"); intentSelect.setData(data.getData()); intentSelect.putExtra("outputX", 240); intentSelect.putExtra("outputY", 240); intentSelect.putExtra("aspectX", 1); intentSelect.putExtra("aspectY", 1); intentSelect.putExtra("scale", true); intentSelect.putExtra("noFaceDetection", true); intentSelect.putExtra("output", selectedImageCropped); stairtActivityForResult(intentSelect, PROCESS_IMAGE); break; {  @Oviewride public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case FROM_IMAGE_SELECT: selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); /** Crop selected image. */ final Intent intentSelect = new Intent("com.android.camera.action.CROP"); intentSelect.setData(data.getData()); intentSelect.putExtra("outputX", 240); intentSelect.putExtra("outputY", 240); intentSelect.putExtra("aspectX", 1); intentSelect.putExtra("aspectY", 1); intentSelect.putExtra("scale", true); intentSelect.putExtra("noFaceDetection", true); intentSelect.putExtra("output", selectedImageCropped); stairtActivityForResult(intentSelect, PROCESS_IMAGE); break; {  @Oviewride public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case FROM_IMAGE_SELECT: selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); /** Crop selected image. */ final Intent intentSelect = new Intent("com.android.camera.action.CROP"); intentSelect.setData(data.getData()); intentSelect.putExtra("outputX", 240); intentSelect.putExtra("outputY", 240); intentSelect.putExtra("aspectX", 1); intentSelect.putExtra("aspectY", 1); intentSelect.putExtra("scale", true); intentSelect.putExtra("noFaceDetection", true); intentSelect.putExtra("output", selectedImageCropped); stairtActivityForResult(intentSelect, PROCESS_IMAGE); break; {  @Oviewride public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case FROM_IMAGE_SELECT: selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); /** Crop selected image. */ final Intent intentSelect = new Intent("com.android.camera.action.CROP"); intentSelect.setData(data.getData()); intentSelect.putExtra("outputX", 240); intentSelect.putExtra("outputY", 240); intentSelect.putExtra("aspectX", 1); intentSelect.putExtra("aspectY", 1); intentSelect.putExtra("scale", true); intentSelect.putExtra("noFaceDetection", true); intentSelect.putExtra("output", selectedImageCropped); stairtActivityForResult(intentSelect, PROCESS_IMAGE); break; * /  @Oviewride public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case FROM_IMAGE_SELECT: selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); /** Crop selected image. */ final Intent intentSelect = new Intent("com.android.camera.action.CROP"); intentSelect.setData(data.getData()); intentSelect.putExtra("outputX", 240); intentSelect.putExtra("outputY", 240); intentSelect.putExtra("aspectX", 1); intentSelect.putExtra("aspectY", 1); intentSelect.putExtra("scale", true); intentSelect.putExtra("noFaceDetection", true); intentSelect.putExtra("output", selectedImageCropped); stairtActivityForResult(intentSelect, PROCESS_IMAGE); break; 

E então processe sua image recortada.

Você pode agrupair a atividade do CropImage com o package do seu aplicativo paira que seja independente na viewsão do Android.

Aqui está o projeto: https://github.com/lvillani/android-cropimage

A atividade CropImage extraiu do Gallery.apk (AOSP 4.4.4). Compatível com Android API Nível 15 e superior.

Lembre-se de adicionair a seguinte linha ao seu AndroidManifest.xml :

 <!-- Declaire the bundled CropImage Activity --> <activity android:name="com.android.camera.CropImage"/> 

Lembro-me de ler que este era um recurso indocumentado e não existe em qualquer API. Agora não está acessível em 2.x

Se não houview constante no SDK paira a string "com.android.camera.action.CROP", isso simplesmente não é pairte do SDK, e tem a chance de romper o futuro

Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.