Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I solved the problem myself now. </p> <p>After giving up to get <code>onActivityResult</code> triggering, I decided to 'hack' Androids encapsulating by passing a static reference from MainActivity to CaptureActivity, even if I know that this isn't a good idea.</p> <p>After the <code>finish()</code> call, MAGICALLY <code>onActivityResult</code> gets triggered with <code>Context.RESULT_CANCELLED</code>... as expected because I don't call <code>setResult</code> anymore. </p> <p>Getting <code>onActivityResult</code> triggered I investigated why it is working now. I found out, that it has something to do with the bitmap, passed to an Intent. If I put a <code>Parcellable</code> Bitmap into my resultIntent <code>onActivityResult</code> never gets fired.</p> <p>So removing following line in the code above will work:</p> <pre><code>intent.putExtra(Config.SCAN_RESULT_BMP, barcode); </code></pre> <p>Thats ok for me, because I don't needed the BitMap really in this other Activity. It was more a 'feature' than a need. </p> <p>If some of you guys want to pass big Data into an <code>Intent</code> like a <code>Bitmap</code>, think about storing it somewhere on SD, passing the path in the Intent, while reading this <code>Bitmap</code> from SD in ParentActivity (<a href="https://developer.android.com/training/camera/photobasics.html" rel="nofollow noreferrer">How to take a photo by Intent</a>).</p> <p>As stated <a href="https://developer.android.com/reference/android/os/TransactionTooLargeException.html" rel="nofollow noreferrer">here</a>, the Limit of a <code>Parcelable</code> is 1MB, thus everything bigger passed to an <code>Intent</code> will cause an <strong>internal</strong> <code>TransactionTooLargeException</code> and will silently fail</p>
 

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