Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am making some progress here that might be useful to some of you reading this question. 1. I have now moved my populate method out from my add method and wrapped it in public method so that I can call this only once after I have populated the entire array of OverlayItems. Also I tried running the app without the debugger ie just running the app on the phone and it works smoothly then. This is not the only time that I have noticed the debugger slowing things down by a factor of 10-20 or more. I had similar problems in the past where running in debug mode slows down some operations by extreme amounts of time.</p> <p>The new code looks like this:</p> <pre><code> private void addOverlaysToMapFromManagedInterestPoints() { this.mapOverlays = myMap.getOverlays(); GeoPoint point; OverlayItem overlayitem; for( managed_interest_point mip : managedObjectManager.interestPoints ) { if(mip==null) { Log.d("MainActivity","this should not happen!"); } TypeOfPoint type = getEnumForTypeOfPoint(mip.ZTYPEOFPOINT); if(type!=null) { switch (type) { case kAnimalHospital: point = new GeoPoint(degreesToMicrodegreesConversion(mip.ZLATITUDE),degreesToMicrodegreesConversion(mip.ZLONGITUDE)); overlayitem = new OverlayItem(point, mip.ZTITLE, mip.ZSUBTITLE); this.animalHospitalOverlay.addOverlay(overlayitem); Log.d("MainActivity","added animalHospital"); break; case kStore: point = new GeoPoint(degreesToMicrodegreesConversion(mip.ZLATITUDE),degreesToMicrodegreesConversion(mip.ZLONGITUDE)); overlayitem = new OverlayItem(point, mip.ZTITLE, mip.ZSUBTITLE); this.storesOverlay.addOverlay(overlayitem); Log.d("MainActivity","added Store point"); break; case kVeterinary: point = new GeoPoint(degreesToMicrodegreesConversion(mip.ZLATITUDE),degreesToMicrodegreesConversion(mip.ZLONGITUDE)); overlayitem = new OverlayItem(point, mip.ZTITLE, mip.ZSUBTITLE); this.veterinariesOverlay.addOverlay(overlayitem); Log.d("MainActivity","added veterinary point"); break; default: Log.d("MainActivity", "unknown enum"); break; }//end switch }//end if }//end foreach this.storesOverlay.callToPopulate(); this.veterinariesOverlay.callToPopulate(); this.animalHospitalOverlay.callToPopulate(); this.mapOverlays.add(this.storesOverlay); this.mapOverlays.add(this.veterinariesOverlay); this.mapOverlays.add(this.animalHospitalOverlay); Log.d("MainActivity","end of foreach in add overlays to map "); } public class AnnotationsOverlay extends ItemizedOverlay { private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); Context mContext; public AnnotationsOverlay(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); } public AnnotationsOverlay(Drawable defaultMarker,Context context) { super(boundCenterBottom(defaultMarker)); mContext=context; } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } //show calloutAssesory view tapped för oss iPhöne människor @Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); //populate(); } public void callToPopulate() { populate(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload