Skip to content
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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down