Xamarin.Android.Maps.Utils
Xamarin.Android.Maps.Utils copied to clipboard
Demo
Is any demo where is used this util? I have seen many demos original util. Your util is a little bit different that is reason why I need see demo your util. Thank you!
Hi @tomassvatek. I don't have any example ready. We can work together and I can guide you on how to create a sample app and then we can add it to the repository.
I will be glad to answer any questions you have.
Hello @alexsorokoletov. First of all thank you for your fast answer. I really appreciate your help!
I have created a demo project. You will find it here: https://github.com/tomassvatek/GoogleMapsClusteringDemo
As I mentioned implementation in Xamarin is a little bit different. I am not sure about implementation IClusterItem interface.
There is original implementation in Java:
There is a imlementation in C#. There are two extra thing - handle property and Dispose method. I am not sure about their implementation. It may be the problem why my app doesn't running.
When I run my app I got this error:
I don't see any null reference.
Please check my code and let me know where is the problem. Thank you!
Nice work, Tomas! Often, if you see that you need to implement IDisposable in some Android-related interface, that is a sign you need to derive from Java.Lang.Object. See below simplest example.
Also, please note that you need +1 ctor (handle/transfer) to make it work correctly.
public class CustomClusterItem : Java.Lang.Object, IClusterItem
{
public CustomClusterItem(SomeDataModel dataItem)
{
ContextData = dataItem;
Position = new LatLng(dataItem.Lat, dataItem.Lon);
}
public CustomClusterItem(IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
: base(handle, transfer)
{
}
public LatLng Position
{
get;
set;
}
public SomeDataModel ContextData;
}
Thanks a lot Alex! My app working now.
Glad to hear that :)
Would you be kind as to create a pull request into this repository and place your app into a sample
folder along with some screenshots?
Of course. I will do it tomorrow :-)
@tomassvatek i don't see any PR's from you open/closed. Can you share your sample?
@gauravsacc here is an example in @tomassvatek 's public repo https://github.com/tomassvatek/GoogleMapsClusteringDemo
@tomassvatek I would really appreciate if you create a pull request so we can merge demo in the project and keep it all in one place.