0

I was recently looking through this Question and one of the answers provided uses the v7 Support library Sorted List and SortedList.Callback.

How would this be used with Xamarin.Android, particularly with RecyclerView?

Also, what is the purpose of SortedList.BatchedCallback

Resources:

https://developer.android.com/reference/android/support/v7/util/SortedList.html https://developer.android.com/reference/android/support/v7/util/SortedList.Callback.html https://developer.android.com/reference/android/support/v7/util/SortedList.BatchedCallback.html

Sample in Java: https://github.com/Wrdlbrnft/Searchable-RecyclerView-Demo

Michael Gabay
  • 553
  • 1
  • 8
  • 14

1 Answers1

2

Android.Support.V7.UtilSortedList is included in the Xamarin.Android.Support.v7.RecyclerView NuGet package (at least as of v25.3.1), if you can use RecyclerView you can use SortedList.

As the documentation describes in the link you posted, BatchedCallback is intended as a performance optimization to avoid bombarding the RecyclerView with many list operations that can be batched into a single operation.

David Oliver
  • 1,841
  • 10
  • 11
  • Would you be able to provide an example? – Michael Gabay Aug 25 '17 at 16:11
  • Of what? The link in your question provides a thorough example. Is there something in particular you're having trouble translating into Xamarin? – David Oliver Aug 26 '17 at 01:22
  • The question is how to implement the Sorted List and Callback in C# for Xamarin. The link provided is an example in Java. – Michael Gabay Aug 28 '17 at 14:23
  • I don't have time to translate the entire sample project, sorry. The C# code will be substantially similar to the Java, modulo Xamarin's naming conventions (CamelCasing, properties in place of get/set methods, etc). – David Oliver Aug 29 '17 at 15:38