New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another memory leak fix #177

Merged
merged 2 commits into from Feb 27, 2013
Jump to file or symbol
Failed to load files and symbols.
+7 −1
Diff settings

Always

Just for now

@@ -6,6 +6,8 @@
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using System;
using Android.Content.Res;
using Android.Graphics;
using Android.Graphics.Drawables;
using Android.Widget;
using Cirrious.MvvmCross.Binding.Interfaces;
@@ -49,8 +51,12 @@ public override void SetValue(object value)
}
var drawableResourceName = GetImageAssetName(stringValue);
var assetStream = AndroidGlobals.ApplicationContext.Assets.Open(drawableResourceName);
Drawable drawable = Drawable.CreateFromStream(assetStream, null);
var options = new BitmapFactory.Options() { InPurgeable = true };
var bitmap = BitmapFactory.DecodeStream(assetStream, null, options);
Drawable drawable = new BitmapDrawable(Resources.System, bitmap);
_imageView.SetImageDrawable(drawable);
}