java - Android: managing bitmap memory when scaling is not an option -


I know about OutOfMemoryError hell which works with bitmap, may contain image-heavy applications is. Generally, I always work around it using caching, adapting images by adaptive, etc.

However, currently I work on an app where a usage case has the ability to take an image and it has been automatically disliked with each other. Small image specification indisputably states that Branded image should have the same size and quality as the original size, so I'm not able to scale.

I have found it impossible to apply already: Attempting to create a bitmap always uses OOME for testing, even with the same dimensions as the original image, even if Android: Large Hype = "True" is set.

Is there any possibility to get around this all?

The relevant code is:

  Private bitmap merge images (bitmap first image, bitmap second image) {bitmap. Config Config = (First Image. SyncFig!) = Faucet)? FirstImage.getConfig (): Bitmap.source. ARGB_8888; Bitmap result only = bitmap.credbitmap (math.max. (First image.jetwidth), second image .getWidth ()), math. (First image. Gatehit), second image. Gatehit ()), config; Canvas merge canvas = new canvas (impact route); Paint paint = new paint (); MergeCanvas.drawBitmap (first image, 0, 0, paint); MergeCanvas.drawBitmap (second image, 0, 0, paint); Return result image; }  

We do the same merging with two bitmap in our app, and The way we did it is to use a relative layout container for both so that they appear in one place, overlayed on one another:

  & lt; Relative layout Android: layout_width = "Wrap_content" android: layout_height = "wrap_content" android: padding = "10dp" & gt; & Lt; ImageView Android: id = "@ + id / discovery_row_photo" Android: layout_width = "130dp" Android: layout_hett = "130dp" /> & Lt; imageView android: id = "@ + id / discovery_row_photo_corner" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignLeft = "@ id / discovery_row_photo" Android: layout_alignTop = "@ id / discovery_row_photo" Android: ContentDescription = "@ Null" Android: src = "@drawable / discovery_corn_badge" /> & Lt; / RelativeLayout & gt;  

The second image view is "Watermark" which I think is going for you. In this way we scale the original image, discovery_row_photo , and discovery_row_photo_corner are placed above it because the second one is mostly transparent so it is not sure if it works well Whether or not it may apply to your use, but it is a useful move.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -