Exemplo n.º 1
0
  private Marker processJSONObject(JSONObject jo) {
    if (jo == null) throw new NullPointerException();

    if (!jo.has("geometry")) throw new NullPointerException();

    Marker ma = null;
    try {
      Double lat = null, lon = null;

      if (!jo.isNull("geometry")) {
        JSONObject geo = jo.getJSONObject("geometry");
        JSONArray coordinates = geo.getJSONArray("coordinates");
        lon = coordinates.getDouble(0);
        lat = coordinates.getDouble(1);
      }
      if (lat != null) {
        String user = jo.getString("id");

        ma = new IconMarker(user, lat, lon, 0, Color.RED, icon);
      }
      Log.i("point", lon + ", " + lat + ": " + ma.getName());
    } catch (Exception e) {
      e.printStackTrace();
    }
    return ma;
  }
  /** {@inheritDoc} */
  public boolean onTouch(View view, MotionEvent me) {
    // See if the motion event is on a Marker
    for (Marker marker : ARData.getMarkers()) {
      if (marker.handleClick(me.getX(), me.getY())) {
        if (me.getAction() == MotionEvent.ACTION_UP) markerTouched(marker);
        return true;
      }
    }

    return super.onTouchEvent(me);
  };