I would start to insert bitmap.Recycle() statements to exclude memory
issues.


On Tue, Jun 12, 2012 at 1:19 PM, SweetLou <hassl...@gmail.com> wrote:

> I've been developing for my Motorola XOOM and my Samsung. Have for the past
> week just been debugging on the XOOM. Note that my application runs
> perfectly fine on it without crashes/freezes. However on my Samsung, the
> device freezes for a random amount of time for like 1 second, then actually
> dies. Only output i get from debugger is The program 'Mono' has exited with
> code 255 (0xff).
>
> I believe it's coming from this code snippet. My application is a image
> gallery in which i fetch byte arrays from a service.
>
> // Code
>
> BitmapFactory.Options op = new BitmapFactory.Options();
>
> //Checks the size of the fetched byte[].
> op.InJustDecodeBounds = true;
> op.InPurgeable = true;
> op.InInputShareable = true;
> bitmap = BitmapFactory.DecodeByteArray(byteArray, 0, byteArray.Length, op);
> op.InJustDecodeBounds = false;
>
> //If the Bitmap is to big resample it with a different sampleSize
> if (op.OutWidth > 500)
>   op.InSampleSize = sampleSize;
>
>
> double divider = (double)op.OutWidth / (double)imageWidth;
> int imageHeight = (int)((double)op.OutHeight / divider);
>
> //Decode the byte[] to the Bitmap
> bitmap = Bitmap.CreateScaledBitmap(BitmapFactory.DecodeByteArray(byteArray,
> 0, byteArray.Length, op), imageWidth, imageHeight, true);
>
> //If both threads for this id have returned continue.
> if (++threadPublicationIds[myId] != valueToReach)
>   return;
>
> // Code
>
> This piece of code is used pretty much. I found it weird that it works
> without problems on my XOOM when obviously something is very wrong with the
> SG SII.
>
> Any others with the same problem when using BitmapFactory?
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/4-2-2-Samsung-Galaxy-SII-Turns-off-at-runtime-tp5710290.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to