-1

I'm tring to show/hide marker depending on its location.

LatLng LocDon = new LatLng(latitude_don, longitude_don);
        Marker mk1 = mMap.addMarker(new MarkerOptions()
            .position(LocDon)  
            .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
    allMarkerMap.put(mk1, Don.class);
    mMap.setOnInfoWindowClickListener(this);
    mk1.setVisible(false);

if(r>=longitude_don&&_r<=longitude_don){
        if(l>=latitude_don&&_l<=latitude_don){
            don = don + 1;
            if(don < 2) {
                vibe.vibrate(200);
                mk1.setVisible(true);                    
            }
        }
     }

    if(r<longitude_don||_r>longitude_don){
        if(l<latitude_don||_l>latitude_don) {
            mk1.setVisible(false);
            vibe.vibrate(1000);
        }
    }

I put two type of vibration to check getting in the if sentence. I can get two type of vibration(200&1000) but only I can't hide marker. Most of answer for these kind of question(hiding marker), people say that using setVisible(false). But why I can't get it? is there anybody help me... Please....

Edited. add log.

03-27 21:58:06.719 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 610K, 10% free 41281K/45652K, paused 2ms+4ms, total 39ms 03-27 21:58:11.624 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off 03-27 21:58:11.654 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off 03-27 21:58:11.694 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 330K, 10% free 41286K/45652K, paused 5ms+5ms, total 40ms 03-27 21:58:16.809 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off 03-27 21:58:16.839 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off 03-27 21:58:16.889 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 141K, 10% free 41332K/45652K, paused 2ms+4ms, total 47ms 03-27 21:58:21.733 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 165K, 10% free 41340K/45652K, paused 6ms+6ms, total 63ms 03-27 21:58:25.677 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 160K, 10% free 41387K/45652K, paused 2ms+3ms, total 75ms 03-27 21:58:30.672 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 198K, 10% free 41408K/45652K, paused 3ms+3ms, total 45ms 03-27 21:58:36.608 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 146K, 10% free 41452K/45652K, paused 2ms+5ms, total 37ms 03-27 21:58:46.558 30659-30659/org.androidtown.realchangdeokgung I/Entered: ON 03-27 21:58:46.608 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 832K, 10% free 41492K/45652K, paused 2ms+5ms, total 41ms 03-27 21:58:46.648 30659-30659/org.androidtown.realchangdeokgung I/Entered: ON 03-27 21:58:56.637 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 381K, 9% free 41759K/45652K, paused 2ms+3ms, total 37ms 03-27 21:58:58.870 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 157K, 9% free 41803K/45652K, paused 2ms+5ms, total 35ms 03-27 21:59:03.684 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 261K, 9% free 41696K/45652K, paused 3ms+6ms, total 47ms 03-27 21:59:07.628 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 141K, 9% free 41742K/45652K, paused 3ms+6ms, total 63ms 03-27 21:59:09.680 30659-30666/org.androidtown.realchangdeokgung I/dalvikvm: Jit: resizing JitTable from 4096 to 8192 03-27 21:59:12.683 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 173K, 9% free 41751K/45652K, paused 6ms+5ms, total 48ms 03-27 21:59:14.795 30659-30803/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 140K, 9% free 41797K/45652K, paused 7ms+6ms, total 97ms 03-27 21:59:17.728 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 117K, 9% free 41831K/45652K, paused 2ms+4ms, total 35ms 03-27 21:59:23.744 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 173K, 9% free 41842K/45652K, paused 2ms+5ms, total 35ms 03-27 21:59:27.728 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 173K, 9% free 41857K/45652K, paused 3ms+4ms, total 42ms 03-27 21:59:31.682 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 135K, 9% free 41904K/45652K, paused 5ms+5ms, total 49ms 03-27 21:59:38.588 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off 03-27 21:59:38.699 30659-30659/org.androidtown.realchangdeokgung D/dalvikvm: GC_EXPLICIT freed 157K, 9% free 41927K/45652K, paused 5ms+8ms, total 62ms 03-27 21:59:38.699 30659-30659/org.androidtown.realchangdeokgung I/Exited: Off

dalami0i
  • 25
  • 8

1 Answers1

-1

use any one its usefull

marker.remove();

or

googlemap.clear();
Akash pasupathi
  • 304
  • 1
  • 14
  • Thank you but I need to remain other marker and only remove the marker. So I can't use map.clear. Also marker.remove() didn't work.... hmmmmmmmmmmmmmmmmmmmmmmmmmm........................ – dalami0i Mar 27 '17 at 13:31
  • i think your marker not get map instance... can you please show your full code... becoz clear some bugs @dalami0i – Akash pasupathi Mar 28 '17 at 05:45