Sabai Phoo
Sabai Phoo

Reputation: 368

Unhandled Exception in Recycler view xamarin

When I am clicking recyclerview, App has stoped and showing error message

Unhandled Exception: Java.Lang.LinkageError: no method with name='getContext' signature='()Landroid/content/Context;' in class Landroid/app/Fragment;"

enter image description here ...

Do you know how to solve that?

Upvotes: 1

Views: 83

Answers (1)

SushiHangover
SushiHangover

Reputation: 74144

Use the Activity that is hosting the Fragment as your context:

var context = fragment.Activity;

So your LinearLayoutManager .ctor would be:

... = new LinearLayoutManager(this.Activity, ....

Note: Do not use images for code, add the formatted text directly to your question.

Upvotes: 1

Related Questions