I've been fixing a library in Xamarin.Android:
https://stackoverflow.com/a/56778629/2889347
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(R.id.mt_recycler); recyclerView.setAdapter(adapter); }
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: https://www.dropbox.com/s/cb9oqtp6efys843/Com.Mancj.Materialsearchbar.MaterialSearchBar.cs?dl=0
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:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets(5,5):
Error MSB6006: "generator.exe" exited with code 1. (MSB6006)
(Xamarin-SearchBar-V2)
If you want to test my current version of the code:
https://github.com/FANMixco/Xamarin-SearchBar
Thanks for any idea.
Answers
I couldn't find how to do it, therefore, I re-wrote the library:
https://github.com/FANMixco/Xamarin-SearchBar