amirpiri / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 0 forks source link

Marker.showInfoWindow() shows nothing #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? Please provide sscce (short, self
contained, correct example) when possible.

map.setClustering(new ClusteringSettings() //
        .iconDataProvider(new ClusterIconDataProvider(getResources())) //
        .clusterSize(96) //
        .addMarkersDynamically(true));

// add about 200 markers 

marker.showInfoWindow(); // not cluster, visible

What is the expected output? What do you see instead?

Info window bubble expected, but nothing happens.

Looks like 
pl.mg6.android.maps.extensions.lazy.LazyMarker.java line 166 
have marker == null

lib version 1.3

Original issue reported on code.google.com by sergei.r...@gmail.com on 16 May 2013 at 6:10

GoogleCodeExporter commented 8 years ago
Thank you for the feedback.

As a workaround for now you can call showInfoWindow in Handler.post(). 
Clustering internally posts creation of real marker objects to save on RPC 
calls.

I'm thinking of two ways to fix it, so it will hit next version.

Original comment by maciek.g...@gmail.com on 16 May 2013 at 7:30

GoogleCodeExporter commented 8 years ago
Thanks for the quick reply.

I've tried the following 

private final Handler handler = new Handler();

// some method start

    this.handler.post(new Runnable() {
        @Override
        public void run() {
            marker.showInfoWindow();
        }
    });
// some method end

but it still doesn't work.

Then I've tried to move camera before showing info window and it seems working 
Ok.

private void showInfoWindow(final Marker marker) {
    this.map.moveCamera(CameraUpdateFactory.newLatLng(marker
        .getPosition()));

    marker.showInfoWindow();
}

Please, explain 

Where is my mistake with handler?

Is my workaround valid?

Regards

Original comment by sergei.r...@gmail.com on 17 May 2013 at 8:15

GoogleCodeExporter commented 8 years ago
If you don't have any side effects any workaround is good until this is fixed.

Seems like this is a separate issue I didn't notice before. Did you try to call

    this.handler.post(new Runnable() {
        @Override
        public void run() {
            marker.showInfoWindow();
        }
    });

on a marker that was not on the screen initially? If you do that when also 
using ClusteringSettings.addMarkersDynamically marker will not be physically 
added to the map, so you won't see info window. I'm adding this as a separate 
bug (Issue 15).

Original comment by maciek.g...@gmail.com on 17 May 2013 at 1:15

GoogleCodeExporter commented 8 years ago
This will hit 1.4, you may clone repo if you want to have the fix already

Original comment by maciek.g...@gmail.com on 18 May 2013 at 4:37

GoogleCodeExporter commented 8 years ago

Original comment by maciek.g...@gmail.com on 8 Aug 2013 at 2:49