// credits Financisto
  // src/ru/orangesoftware/financisto/activity/PreferencesActivity.java
  private void addShortcut(String activity, int nameId, int iconId, Bundle extra) {
    Intent shortcutIntent = createShortcutIntent(activity);
    if (extra != null) {
      shortcutIntent.putExtras(extra);
    }
    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(nameId));
    intent.putExtra(
        Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, iconId));
    intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");

    if (Utils.isIntentReceiverAvailable(this, intent)) {
      sendBroadcast(intent);
      Toast.makeText(getBaseContext(), getString(R.string.pref_shortcut_added), Toast.LENGTH_LONG)
          .show();
    } else {
      Toast.makeText(
              getBaseContext(), getString(R.string.pref_shortcut_not_added), Toast.LENGTH_LONG)
          .show();
    }
  }