/** Update GUI from currently selected POI Load POI actions */
  private void updateGUI() {
    try {
      TextView poiName = (TextView) findViewById(R.id.textPOIName);
      TextView poiDescription = (TextView) findViewById(R.id.textPOIDescription);
      View layoutLocation = findViewById(R.id.layoutPOILocation);

      poiThumbnail = (RemoteImageView) findViewById(R.id.imagePOIThumbnail);

      if (mPOI.getThumbnailURL().length() > 0) {
        poiThumbnail.setRemoteSource(new String(mPOI.getThumbnailURL()));
      } else {
        poiThumbnail.setVisibility(View.INVISIBLE);
      }

      final String name = mPOI.getName();
      if (name != null && name.length() >= 0) poiName.setText(name);

      poiDescription.setText(mPOI.getDescription());

      // add clickable links to strings like emails and websites
      Linkify.addLinks(poiDescription, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

      // show location information only if the POI has LLA coordinates
      if (mPOI.hasLLA()) {
        TextView poiLocation = (TextView) findViewById(R.id.textPOILocation);
        LLACoordinate mylocation =
            JunaioPlugin.getSensorsManager(getApplicationContext()).getLocation();

        // get the distance and store in results[0], get the bearing and
        // store it in results[1]
        float[] results = new float[2];
        Location.distanceBetween(
            mylocation.getLatitude(),
            mylocation.getLongitude(),
            mPOI.getLocation().getLatitude(),
            mPOI.getLocation().getLongitude(),
            results);

        // get the proper units. To change units see
        // JunaioPlugin.Settings.useImperialUnits
        poiLocation.setText(
            JunaioUtils.getRelativeLocationString(
                mPOI.getCurrentDistance(), 0, false, JunaioPlugin.Settings.useImperialUnits));

        JunaioPlugin.log("Bearing: " + results[1]);

        pointer.updateOrientation(-results[1]);
        layoutLocation.setVisibility(View.VISIBLE);
      } else {
        layoutLocation.setVisibility(View.GONE);
      }

      loadPOIActions();

    } catch (Exception e) {
      JunaioPlugin.log("POIDetailDialog.updateGUI: " + e.getMessage());
    }
  }
  /** Set POI action buttons */
  private void loadPOIActions() {
    ViewGroup root = (ViewGroup) findViewById(R.id.actionButtonContainer);

    // get the popup objet and add the buttons to the container
    ObjectPopup popup = mPOI.getObjectPopup();
    ObjectButtonVector buttons = popup.getButtons();
    for (int i = 0, j = (int) buttons.size(); i < j; i++) {
      ObjectButton button = buttons.get(i);
      addButton2(button, root);
    }

    // if the routing is enabled, check if we have a navigation intent
    // handler and add a button for navigation
    if (mPOI.isRoutingEnabled()) {
      Intent intent =
          new Intent(
              android.content.Intent.ACTION_VIEW,
              Uri.parse(
                  "google.navigation:q="
                      + mPOI.getLocation().getLatitude()
                      + ","
                      + mPOI.getLocation().getLongitude()));
      List<ResolveInfo> list =
          getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
      if (list.size() > 0) {
        ObjectButton button = new ObjectButton();
        button.setButtonName(getString(R.string.MSG_TITLE_DIRECTIONS));
        button.setButtonValue(
            "google.navigation:q="
                + mPOI.getLocation().getLatitude()
                + ","
                + mPOI.getLocation().getLongitude());
        addButton2(button, root);
      }
    }
  }