0

I am binding the github project ChatKit

I do this xml

<attr name="managedType" path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onBindViewHolder']/parameter[1]">Android.Support.V7.Widget.RecyclerView.ViewHolder</attr>
  <attr name="managedType" path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onBindViewHolder']/parameter[2]">int</attr>

but vs still throw the error for me:

1>D:\TempApps\ChatKitDebugBinding\ChatKitDebugBinding\obj\Debug\generated\src\Com.Stfalcon.Chatkit.Messages.MessagesListAdapter.cs(10,23,10,42): error CS0534: 'MessagesListAdapter' does not implement inherited abstract member 'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup, int)'

And there is any way to fix it?

Eric
  • 111
  • 12

2 Answers2

0

The easiest way to fix this is by partial classes. You can do this by creating a partial class of MessagesListAdapter with your appropriate namespace:

namespace Com.Your.Namespace
{
    partial class MessagesListAdapter
    {
    }
}

Next you can implement the overrides inside this partial class:

public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    throw new NotImplementedException();
}

public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
{
    throw new NotImplementedException();
}

Finally you can look through the source code and use the newly generated binding classes to implement these methods in C#:

OnBindViewHolder

OnCreateViewHolder

Jon Douglas
  • 13,006
  • 4
  • 38
  • 51
0

Check your generated source code. The method might actually be there, but with a virtual flag instead of an override flag. If so, you can fix it with managedOverride like this in metadata: you might need the ones you added in addtion to these.

<attr path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onCreateViewHolder']" name="managedOverride">override</attr>

<attr path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onBindViewHolder']" name="managedOverride">override</attr>

Adam Diament
  • 4,290
  • 3
  • 34
  • 55