Xamarin.Android.Maps.Utils icon indicating copy to clipboard operation
Xamarin.Android.Maps.Utils copied to clipboard

Demo

Open tomassvatek opened this issue 7 years ago • 8 comments

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!

tomassvatek avatar Dec 11 '17 14:12 tomassvatek

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.

alexsorokoletov avatar Dec 11 '17 16:12 alexsorokoletov

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:

image

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.

image

When I run my app I got this error:

exception

I don't see any null reference.

Please check my code and let me know where is the problem. Thank you!

tomassvatek avatar Dec 12 '17 15:12 tomassvatek

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;
}

alexsorokoletov avatar Dec 12 '17 23:12 alexsorokoletov

Thanks a lot Alex! My app working now.

tomassvatek avatar Dec 13 '17 00:12 tomassvatek

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?

alexsorokoletov avatar Dec 13 '17 00:12 alexsorokoletov

Of course. I will do it tomorrow :-)

tomassvatek avatar Dec 13 '17 00:12 tomassvatek

@tomassvatek i don't see any PR's from you open/closed. Can you share your sample?

gauravsacc avatar Jan 12 '18 05:01 gauravsacc

@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.

alexsorokoletov avatar Jan 26 '18 02:01 alexsorokoletov