code: public static void launchActivity(Activity context, Class<? extends Activity> activity, boolean closeCurrentActivity, Map<String, String> params) {
          Intent intent = new Intent(context, activity);
  
          if (params != null) {
              Bundle bundle = new Bundle();
              for (Entry<String, String> param : params.entrySet()) {
                  bundle.putString(param.getKey(), param.getValue());
              }
              intent.putExtras(bundle);
          }
  
          context.startActivity(intent);
          if (closeCurrentActivity) {
              context.finish();
          }
      }
docs: Launch an Activity.
  
  @param context              The current Context or Activity that this method is called from.
  @param activity             The new Activity to open.
  @param closeCurrentActivity whether or not the current activity should close.
  @param params               Parameters to add to the intent as a Bundle.