Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo #7

Open
tomassvatek opened this issue Dec 11, 2017 · 8 comments
Open

Demo #7

tomassvatek opened this issue Dec 11, 2017 · 8 comments

Comments

@tomassvatek
Copy link

tomassvatek commented Dec 11, 2017

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!

@alexsorokoletov
Copy link
Owner

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.

@tomassvatek
Copy link
Author

tomassvatek commented Dec 12, 2017

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!

@alexsorokoletov
Copy link
Owner

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

@tomassvatek
Copy link
Author

tomassvatek commented Dec 13, 2017

Thanks a lot Alex! My app working now.

@alexsorokoletov
Copy link
Owner

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?

@tomassvatek
Copy link
Author

Of course. I will do it tomorrow :-)

@gauravsacc
Copy link

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

@alexsorokoletov
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants