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

Fix MissingMethodException when using MvxImageView pre-Android API 21 #2011

Merged
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
10 changes: 6 additions & 4 deletions MvvmCross/Binding/Droid/Views/MvxImageView.cs
Expand Up @@ -85,15 +85,17 @@ protected IMvxImageHelper<Bitmap> ImageHelper
}
}

public MvxImageView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes)
public MvxImageView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes)
: base(context, attrs, defStyleAttr, defStyleRes)
{
Init(context, attrs);
}

public MvxImageView(Context context, IAttributeSet attrs, int defStyleAttr)
: this(context, attrs, defStyleAttr, 0)
: base(context, attrs, defStyleAttr) // Don't call overload constructor since it is added in API 21
// which could cause missing method exceptions on earlier API levels
{
Init(context, attrs);
}

public MvxImageView(Context context, IAttributeSet attrs)
Expand Down Expand Up @@ -150,7 +152,7 @@ private void Init(Context context, IAttributeSet attrs)
typedArray.Recycle();
}

public override void SetImageBitmap (Bitmap bm)
public override void SetImageBitmap(Bitmap bm)
{
if (Handle != IntPtr.Zero)
{
Expand All @@ -159,7 +161,7 @@ public override void SetImageBitmap (Bitmap bm)
// Don't try to update disposed or recycled bitmap
return;
}
base.SetImageBitmap (bm);
base.SetImageBitmap(bm);

MvxMainThreadDispatcher.Instance.RequestMainThreadAction(() =>
{
Expand Down