public void requestDialog(
      final int id,
      final String title,
      final String initialValue,
      final SoftTextDialogInputListener listener) {
    logger.log(
        Level.INFO,
        "requestDialog: title: {0}, initialValue: {1}",
        new Object[] {title, initialValue});

    JmeAndroidSystem.getActivity()
        .runOnUiThread(
            new Runnable() {

              @Override
              public void run() {

                final FrameLayout layoutTextDialogInput =
                    new FrameLayout(JmeAndroidSystem.getActivity());
                final EditText editTextDialogInput = new EditText(JmeAndroidSystem.getActivity());
                editTextDialogInput.setWidth(LayoutParams.FILL_PARENT);
                editTextDialogInput.setHeight(LayoutParams.FILL_PARENT);
                editTextDialogInput.setPadding(20, 20, 20, 20);
                editTextDialogInput.setGravity(Gravity.FILL_HORIZONTAL);

                editTextDialogInput.setText(initialValue);

                switch (id) {
                  case SoftTextDialogInput.TEXT_ENTRY_DIALOG:
                    editTextDialogInput.setInputType(InputType.TYPE_CLASS_TEXT);
                    break;

                  case SoftTextDialogInput.NUMERIC_ENTRY_DIALOG:
                    editTextDialogInput.setInputType(
                        InputType.TYPE_CLASS_NUMBER
                            | InputType.TYPE_NUMBER_FLAG_DECIMAL
                            | InputType.TYPE_NUMBER_FLAG_SIGNED);
                    break;

                  case SoftTextDialogInput.NUMERIC_KEYPAD_DIALOG:
                    editTextDialogInput.setInputType(InputType.TYPE_CLASS_PHONE);
                    break;

                  default:
                    break;
                }

                layoutTextDialogInput.addView(editTextDialogInput);

                AlertDialog dialogTextInput =
                    new AlertDialog.Builder(JmeAndroidSystem.getActivity())
                        .setTitle(title)
                        .setView(layoutTextDialogInput)
                        .setPositiveButton(
                            "OK",
                            new DialogInterface.OnClickListener() {

                              public void onClick(DialogInterface dialog, int whichButton) {
                                /* User clicked OK, send COMPLETE action
                                 * and text */
                                listener.onSoftText(
                                    SoftTextDialogInputListener.COMPLETE,
                                    editTextDialogInput.getText().toString());
                              }
                            })
                        .setNegativeButton(
                            "Cancel",
                            new DialogInterface.OnClickListener() {

                              public void onClick(DialogInterface dialog, int whichButton) {
                                /* User clicked CANCEL, send CANCEL action
                                 * and text */
                                listener.onSoftText(
                                    SoftTextDialogInputListener.CANCEL,
                                    editTextDialogInput.getText().toString());
                              }
                            })
                        .create();

                dialogTextInput.show();
              }
            });
  }
  /**
   * <code>createView</code> creates the GLSurfaceView that the renderer will draw to.
   *
   * <p>The result GLSurfaceView will receive input events and forward them to the Application. Any
   * rendering will be done into the GLSurfaceView. Only one GLSurfaceView can be created at this
   * time. The given configType specifies how to determine the display configuration.
   *
   * @param configType ConfigType.FASTEST (Default) | ConfigType.LEGACY | ConfigType.BEST
   * @param eglConfigVerboseLogging if true show all found configs
   * @return GLSurfaceView The newly created view
   */
  public GLSurfaceView createView(ConfigType configType, boolean eglConfigVerboseLogging) {
    // if simulated joysticks are used, init the window to update the activity used to
    // get the window orientation
    if (androidSensorJoyInput != null && androidSensorJoyInput instanceof AndroidSensorJoyInput) {
      ((AndroidSensorJoyInput) androidSensorJoyInput).initWindow();
    }

    // Start to set up the view
    view = new AndroidGLSurfaceView(JmeAndroidSystem.getActivity());
    if (androidInput == null) {
      androidInput = new AndroidInput(view);
    } else {
      androidInput.setView(view);
    }
    if (configType == ConfigType.LEGACY) {
      // Hardcoded egl setup
      clientOpenGLESVersion = 2;
      view.setEGLContextClientVersion(2);
      // RGB565, Depth16
      view.setEGLConfigChooser(5, 6, 5, 0, 16, 0);
      logger.info("ConfigType.LEGACY using RGB565");
    } else {
      EGL10 egl = (EGL10) EGLContext.getEGL();
      EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

      int[] version = new int[2];
      if (egl.eglInitialize(display, version) == true) {
        logger.log(
            Level.INFO, "Display EGL Version: {0}.{1}", new Object[] {version[0], version[1]});
      }

      try {
        // Create a config chooser
        AndroidConfigChooser configChooser = new AndroidConfigChooser(configType);
        // Init chooser
        if (!configChooser.findConfig(egl, display)) {
          listener.handleError("Unable to find suitable EGL config", null);
          return null;
        }

        clientOpenGLESVersion = configChooser.getClientOpenGLESVersion();
        if (clientOpenGLESVersion < 2) {
          listener.handleError("OpenGL ES 2.0 is not supported on this device", null);
          return null;
        }

        // Requesting client version from GLSurfaceView which is extended by
        // AndroidInput.
        view.setEGLContextClientVersion(clientOpenGLESVersion);
        view.setEGLConfigChooser(configChooser);
        view.getHolder().setFormat(configChooser.getPixelFormat());
      } finally {
        if (display != null) {
          egl.eglTerminate(display);
        }
      }
    }

    view.setFocusableInTouchMode(true);
    view.setFocusable(true);
    view.getHolder().setType(SurfaceHolder.SURFACE_TYPE_GPU);
    if (configType == ConfigType.BEST_TRANSLUCENT) {
      // This is important to allow the GL surface to have a translucent background
      view.setZOrderOnTop(true);
    }
    view.setRenderer(this);

    return view;
  }