title: How to refresh google map apiv2
body: <p>I have a timer.it is running every 5 minute.ı write a method called konumlarıAl in timer run method. this method get locations data from database.When konumlarıAl run,HaritaKonumGoster is method calling.I want to delete all markers and show new location data marker on map without refreshing page.</p>
  
  <h1>my code</h1>
  
  <pre><code>private void HaritaKonumGoster() {
          // TODO Auto-generated method stub
          if (googleHarita == null) {
              googleHarita = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.haritafragment))
                      .getMap();
              if (googleHarita != null) {
                  googleHarita.clear();
                  if(mrks.size()!=0)
                  {
                       for (Marker marker: mrks) {
                              marker.remove();
                          }
                          mrks.clear();
                  }
                  googleHarita.setMyLocationEnabled(true);
  
                  LocationManager locationManager=(LocationManager)getSystemService(LOCATION_SERVICE);
  
                  Criteria criteria=new Criteria();
  
                  String provider =locationManager.getBestProvider(criteria, true);
  
                  Location mylocation=locationManager.getLastKnownLocation(provider);
                   double latitude=0;
                  double longitude=0;
                  double mylatitude=0;
                  double myLongtitude=0;
                   //double latitude=enlem;
                      //double longitude=boylam;
                  if (mylocation != null){
                      mylatitude=mylocation.getLatitude();
                      myLongtitude=mylocation.getLongitude();
                  }
                  BitmapDescriptor bitmapDescriptor 
                     = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN);
  
                  try{  
                for (int i = 0; i &lt; degiskenler.taksici.size(); i++) {
  
                     latitude=Double.parseDouble(degiskenler.taksici.get(i).enlem.trim());
                     longitude=Double.parseDouble(degiskenler.taksici.get(i).boylam.trim());
                     LatLng istanbulKoordinat = new LatLng(latitude,longitude);
                     Marker m= googleHarita.addMarker(new MarkerOptions().position(istanbulKoordinat).title("Kız Kulesi").icon(bitmapDescriptor));
                     googleHarita.moveCamera(CameraUpdateFactory.newLatLngZoom(istanbulKoordinat, 7)); 
                     mrks.add(m);
                 //   Toast.makeText(getBaseContext(),"harita :)",Toast.LENGTH_LONG).show();
  
                 }
                  }
                  catch(Exception exception)  {
  
                      Toast.makeText(getBaseContext(),"harita olmadı",Toast.LENGTH_LONG).show();
                  }
  
                  googleHarita.addMarker(new MarkerOptions().position(new LatLng(mylatitude, myLongtitude)).title("you hereeee"));
              }
          }
      }
  </code></pre>
  
  <h1>location update every 5 minute method</h1>
  
  <pre><code>  private void LocationUpdateEvery5minute() {
          // TODO Auto-generated method stub
  
                 zamanlayici = new Timer();
                 yardimci = new Handler(Looper.getMainLooper());
                 zamanlayici.scheduleAtFixedRate(new TimerTask()
                 {
             @Override
             public void run(){ 
                  yardimci.post(new Runnable()
                 {
                   public void run()
                   {  Toast.makeText(getBaseContext(), "timera girdi",Toast.LENGTH_SHORT).show();
                       konumlarıAl();
  
           }
          });    
  
         }
  
        }, 0, ZAMAN);
  
  
              }
  </code></pre>