Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing an image with intent causes "Failed Binder Transaction", but still displays image correctly
    primarykey
    data
    text
    <p><strong>FIXED<br> In the end I created my bitmap on the last activity instead of passing it with intents which solved the problem.</strong></p> <p>So I'm taking an image and some text and then place it on the image, then I scale the bitmap and create a new bitmap from that. Then pass that bitmap with an intent to the next activity which shows the image and gives an option to save that image to sd.</p> <p>Although I do get the failed binder transaction which seemed to be caused by passing too much data between intents, but the image still gets passed fine so should I worry about the error or ignore it because it still works like it should?</p> <p>I create/shrink the bitmap like this</p> <pre><code> strTop = txtTop.getText().toString(); strButtom = txtButtom.getText().toString(); combinedBitmap = BitmapFactory.decodeResource(getResources(), lstImages.get(index)).copy(Bitmap.Config.ARGB_8888, true); Paint paint = new Paint(); paint.setStyle(Style.FILL); paint.setColor(Color.RED); paint.setTextSize(combinedBitmap.getHeight()/10); paint.setTextAlign(Paint.Align.CENTER); Canvas canvas = new Canvas(combinedBitmap); canvas.drawText(strTop, (canvas.getWidth() / 2), paint.getTextSize()+10, paint); canvas.drawText(strButtom, (canvas.getWidth() / 2), combinedBitmap.getHeight()-paint.getTextSize()-10, paint); Intent intent = new Intent(this, SaveToSD.class); int width = combinedBitmap.getWidth(); int height = combinedBitmap.getHeight(); int newWidth = 400; int newHeight = 240; float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap newbm = Bitmap.createBitmap(combinedBitmap, 0, 0, width, height, matrix,true); intent.putExtra("combinedBitmap", newbm); startActivity(intent); </code></pre> <p>And I retrieve it with this code:<br> <code>combinedBitmap = getIntent().getExtras().getParcelable("combinedBitmap"); imgView.setImageBitmap(combinedBitmap);</code></p>
    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.
    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