code: private OnItemClickListener createIntentClickListener(@NonNull final Activity activity,
                                                            @NonNull final Intent intent,
                                                            @NonNull final List<ResolveInfo> resolveInfos) {
          return new OnItemClickListener() {
  
              @Override
              public void onItemClick(final AdapterView<?> parent, final View view,
                                      final int position, final long id) {
                  ActivityInfo activityInfo = resolveInfos.get(position).activityInfo;
                  ComponentName componentName =
                          new ComponentName(activityInfo.applicationInfo.packageName,
                                  activityInfo.name);
                  intent.setFlags(
                          Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                  intent.setComponent(componentName);
                  activity.startActivity(intent);
                  dismiss();
              }
  
          };
      }
docs: Creates and returns a listener, which allows to start an app, when an item of the bottom
  sheet has been clicked.
  
  @param activity
  The activity, the bottom sheet belongs to, as an instance of the class {@link
  Activity}. The activity may not be null
  @param intent
  The intent, which should be passed to the started app, as an instance of the class
  {@link Intent}. The intent may not be null
  @param resolveInfos
  A list, which contains the resolve infos, which correspond to the apps, which are
  able to handle the intent, as an instance of the type {@link List} or an empty list,
  if no apps are able to handle the intent
  @return The listener, which has been created, as an instance of the type {@link
  OnItemClickListener}