public void handleMessage(Message msg) { int progress = msg.getData().getInt("progress"); int max = msg.getData().getInt("max"); boolean finish = msg.getData().getBoolean("finish"); if (progress != 0) readxmlDialog.setProgress(progress); if (max != 0) readxmlDialog.setMax(max); if (finish) { // new hotspots were not added to myMapView.getOverlays(); // this would cause a crash in nonmain thread; so this is done // here List<Overlay> mapOverlays = myMapView.getOverlays(); for (Iterator<HotspotOld> iterator = hotspots.iterator(); iterator.hasNext(); ) { HotspotOld hotspot = (HotspotOld) iterator.next(); mapOverlays.add(hotspot.getGoogleOverlay()); } // mapOverlays.addAll(hotspots); dismissDialog(READXML_DIALOG); readxml_completed = true; } }