public static ShowcaseView insertShowcaseView(
     float x, float y, Activity activity, String title, String detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcasePosition(x, y);
   sv.setText(title, detailText);
   return sv;
 }
 /**
  * Quickly insert a ShowcaseView into an Activity, highlighting an item.
  *
  * @param type the type of item to showcase (can be ITEM_ACTION_HOME, ITEM_TITLE_OR_SPINNER,
  *     ITEM_ACTION_ITEM or ITEM_ACTION_OVERFLOW)
  * @param itemId the ID of an Action item to showcase (only required for ITEM_ACTION_ITEM
  * @param activity Activity to insert the ShowcaseView into
  * @param title Text to show as a title. Can be null.
  * @param detailText More detailed text. Can be null.
  * @param options A set of options to customise the ShowcaseView
  * @return the created ShowcaseView instance
  */
 public static ShowcaseView insertShowcaseViewWithType(
     int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcaseItem(type, itemId, activity);
   sv.setText(title, detailText);
   return sv;
 }
  public ShowcaseView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Get the attributes for the ShowcaseView
    final TypedArray styled =
        context
            .getTheme()
            .obtainStyledAttributes(
                attrs, R.styleable.ShowcaseView, R.attr.showcaseViewStyle, R.style.ShowcaseView);
    backColor =
        styled.getInt(R.styleable.ShowcaseView_sv_backgroundColor, Color.argb(128, 80, 80, 80));
    detailTextColor = styled.getColor(R.styleable.ShowcaseView_sv_detailTextColor, Color.WHITE);
    titleTextColor =
        styled.getColor(R.styleable.ShowcaseView_sv_titleTextColor, Color.parseColor("#49C0EC"));
    buttonText = styled.getString(R.styleable.ShowcaseView_sv_buttonText);
    styled.recycle();

    metricScale = getContext().getResources().getDisplayMetrics().density;
    mEndButton = (Button) LayoutInflater.from(context).inflate(R.layout.showcase_button, null);

    ConfigOptions options = new ConfigOptions();
    options.showcaseId = getId();
    setConfigOptions(options);
  }