Forum Xamarin.Android

How to add a method to a Binding Library in Xamarin.Android?

I've been fixing a library in Xamarin.Android:

However, I found that an important method is missing in my code:

 * Sets a custom adapter for suggestions list view.
 * @param suggestionAdapter customized adapter
public void setCustomSuggestionAdapter(SuggestionsAdapter suggestionAdapter) {
    this.adapter = suggestionAdapter;
    RecyclerView recyclerView = findViewById(;

I tried to implement a partial class:

using System;
using System.Collections.Generic;
using Android.Runtime;
using Java.Interop;

namespace Com.Mancj.Materialsearchbar

    public partial class MaterialSearchBar

But I get a message like this one:

Partial class with single part.

The generated class is this one:

I experienced in the past still a very specific issue that I couldn't use the FindViewByID since it was not able to find anything and I also tried a code like this one in my Metadata.xml:

<add-node path="/api/package[@name='com.mancj.materialsearchbar.adapter']/class[@name='MaterialSearchBar']/method[@name='setCustomSuggestionAdapter'] and count(parameter)=1 and parameter[1][@type='Com.Mancj.Materialsearchbar.Adapter.SuggestionsAdapter']" />

But the VS crashes:

Error MSB6006: "generator.exe" exited with code 1. (MSB6006)

If you want to test my current version of the code:

Thanks for any idea.

Best Answer


Sign In or Register to comment.