Android Open Source - SDCrimeZone Crime Map Overlay






From Project

Back to project page SDCrimeZone.

License

The source code is released under:

Apache License

If you think the Android project SDCrimeZone listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.crimezone.sd;
/*from  www.ja  v a 2s  .  c om*/
import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class CrimeMapOverlay extends ItemizedOverlay<OverlayItem> {

  private ArrayList<OverlayItem> overlays = new ArrayList<OverlayItem>();
  private Context mContext;

  public CrimeMapOverlay(Drawable defaultMarker, Context context) {
    super(boundCenterBottom(defaultMarker));
    mContext = context;
  }

  @Override
  protected OverlayItem createItem(int i) {
    return overlays.get(i);
  }

  @Override
  public int size() {
    return overlays.size();
  }

  @Override
  protected boolean onTap(int index) {
    if (overlays.size() > 0) {
      OverlayItem item = overlays.get(index);

      // Do stuff here when you tap, i.e. :
      AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
      dialog.setTitle(item.getTitle());
      dialog.setMessage(item.getSnippet());
      AlertDialog mDialog = dialog.create();
      mDialog.setCanceledOnTouchOutside(true);
      mDialog.show();
    }

    // return true to indicate we've taken care of it
    return true;
  }

  public void addOverlay(OverlayItem overlay) {
    overlays.add(overlay);
    populate();
  }

}




Java Source Code List

com.crimezone.sd.BccCodeEnum.java
com.crimezone.sd.CircleMapOverlay.java
com.crimezone.sd.CrimeMapOverlay.java
com.crimezone.sd.Data.java
com.crimezone.sd.SDCrimeMapActivity.java
com.crimezone.sd.SDCrimeSummaryActivity.java
com.crimezone.sd.SDCrimeSummaryWorker.java
com.crimezone.sd.SDCrimeZoneActivity.java
com.crimezone.sd.SDCrimeZoneApplication.java
com.crimezone.sd.SDPopulateCrimeListActivity.java
com.crimezone.sd.ShowCrimeMapActivity.java