コード例 #1
0
 @Override
 protected ArrayList<MarkerOptions> doInBackground(Void... arg0) {
   ArrayList<MarkerOptions> markerOptionsParadas = new ArrayList<MarkerOptions>();
   MarkerOptions parada;
   ArrayList<Integer> paradas = LoadFromWeb.buscarParadas(misCoordenadas);
   synchronized (DataStorage.paradas) {
     for (Integer idParada : paradas) {
       Parada p = DataStorage.paradas.get(idParada);
       parada =
           new MarkerOptions()
               .title(String.valueOf(p.getId()))
               .snippet(p.getNombre())
               .position(new LatLng(p.getCoord()[1], p.getCoord()[0]))
               .icon(bitmapParada);
       markerOptionsParadas.add(parada);
     }
   }
   return markerOptionsParadas;
 }
コード例 #2
0
 @Override
 protected void onPostExecute(ArrayList<MarkerOptions> result) {
   ArrayList<Integer> paradasAgregadas = new ArrayList<Integer>();
   if (getMap() != null) {
     getMap().clear();
     dibujarDistancia();
   }
   for (MarkerOptions mo : result) {
     synchronized (DataStorage.paradas) {
       Parada p = DataStorage.paradas.get(Integer.parseInt(mo.getTitle()));
       if (p.getRepetida() != null) {
         if (paradasAgregadas.contains(p.getRepetida().getId())) {
           continue;
         }
       }
       paradasAgregadas.add(Integer.parseInt(mo.getTitle()));
       if (getMap() != null) {
         getMap().addMarker(mo);
       }
     }
   }
   super.onPostExecute(result);
 }