Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Tablet cannot return to intent after cropping
    primarykey
    data
    text
    <p>Hi I have this app where I allow user to take image and crop. It works on my phones but not on my Samsung Galaxy Tablet. The "Saving image" dialog just remain and not return to my app's onActivityResult... It does return if I cancel crop[</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == 1337 &amp;&amp; resultCode == -1) { File fi = new File("/sdcard/tmp"); // get the Uri for the captured image - NEW try { mImageCaptureUri = Uri .parse(android.provider.MediaStore.Images.Media .insertImage(getContentResolver(), fi.getAbsolutePath(), null, null)); // Log.i("",String.valueOf(thumbnail.getHeight())); } catch (Exception ex) { String errorMessage = "Your device doesn't support the crop action!"; Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); toast.show(); } performCrop(); } if (requestCode == PIC_CROP) { try { final TextView imgTv = (TextView) findViewById(R.id.info); // Bundle extras = data.getExtras(); // thumbnail = extras.getParcelable("data"); Log.i("a", "test"); // NEW final String filePath = Environment.getExternalStorageDirectory() + "/temporary_holder.jpg"; thumbnail = BitmapFactory.decodeFile(filePath); ImageView image = (ImageView) findViewById(R.id.img); image.setImageBitmap(thumbnail); </code></pre> <p>}}</p> <pre><code>private void performCrop() { try { // call the standard crop action intent (the user device may not // support it) Intent cropIntent = new Intent("com.android.camera.action.CROP"); // indicate image type and Uri cropIntent.setDataAndType(mImageCaptureUri, "image/*"); // set crop properties cropIntent.putExtra("crop", "true"); // indicate aspect of desired crop cropIntent.putExtra("aspectX", 4); cropIntent.putExtra("aspectY", 3); // indicate output X and Y cropIntent.putExtra("outputX", 500); cropIntent.putExtra("outputY", 300); // retrieve data on return // cropIntent.putExtra("return-data", true); File f = new File(Environment.getExternalStorageDirectory(), "/temporary_holder.jpg"); try { f.createNewFile(); } catch (IOException ex) { Log.e("io", ex.getMessage()); } uri = Uri.fromFile(f); cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(cropIntent, PIC_CROP); } // respond to users whose devices do not support the crop action catch (ActivityNotFoundException anfe) { // display an error message String errorMessage = "Your device doesn't support the crop action!"; Toast toast = Toast .makeText(this, errorMessage, Toast.LENGTH_SHORT); toast.show(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload