Class AndroidHarnessFragment

java.lang.Object
androidx.fragment.app.Fragment
com.jme3.app.AndroidHarnessFragment
All Implemented Interfaces:
com.jme3.system.SystemListener

public abstract class AndroidHarnessFragment extends androidx.fragment.app.Fragment implements com.jme3.system.SystemListener
AndroidX Fragment that hosts a jME application on Android 11+.

The fragment is intentionally small: subclasses create the application and optionally customize settings; this class owns the Android view lifecycle and forwards render callbacks to LegacyApplication.

  • Field Details

    • view

      protected android.opengl.GLSurfaceView view
    • app

      protected com.jme3.app.LegacyApplication app
    • finishOnAppStop

      protected boolean finishOnAppStop
  • Constructor Details

    • AndroidHarnessFragment

      public AndroidHarnessFragment()
  • Method Details

    • onAttach

      public void onAttach(android.content.Context context)
      Overrides:
      onAttach in class androidx.fragment.app.Fragment
    • getJmeApplication

      public com.jme3.app.Application getJmeApplication()
    • setFinishOnAppStop

      public void setFinishOnAppStop(boolean finishOnAppStop)
    • onCreate

      public void onCreate(android.os.Bundle savedInstanceState)
      Overrides:
      onCreate in class androidx.fragment.app.Fragment
    • createApplication

      protected abstract com.jme3.app.LegacyApplication createApplication() throws Exception
      Creates the jME application hosted by this fragment.
      Returns:
      the application instance
      Throws:
      Exception - if the application cannot be created
    • onCreateView

      public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
      Overrides:
      onCreateView in class androidx.fragment.app.Fragment
    • onResume

      public void onResume()
      Overrides:
      onResume in class androidx.fragment.app.Fragment
    • onPause

      public void onPause()
      Overrides:
      onPause in class androidx.fragment.app.Fragment
    • onDestroyView

      public void onDestroyView()
      Overrides:
      onDestroyView in class androidx.fragment.app.Fragment
    • onDestroy

      public void onDestroy()
      Overrides:
      onDestroy in class androidx.fragment.app.Fragment
    • handleError

      public void handleError(String errorMsg, Throwable throwable)
      Specified by:
      handleError in interface com.jme3.system.SystemListener
    • initializeLogHandler

      protected void initializeLogHandler()
    • initialize

      public void initialize()
      Specified by:
      initialize in interface com.jme3.system.SystemListener
    • reshape

      public void reshape(int width, int height)
      Specified by:
      reshape in interface com.jme3.system.SystemListener
    • reshape

      public void reshape(int logicalWidth, int logicalHeight, int framebufferWidth, int framebufferHeight)
      Specified by:
      reshape in interface com.jme3.system.SystemListener
    • rescale

      @Deprecated public void rescale(float x, float y)
      Deprecated.
      Specified by:
      rescale in interface com.jme3.system.SystemListener
    • update

      public void update()
      Specified by:
      update in interface com.jme3.system.SystemListener
    • requestClose

      public void requestClose(boolean esc)
      Specified by:
      requestClose in interface com.jme3.system.SystemListener
    • destroy

      public void destroy()
      Specified by:
      destroy in interface com.jme3.system.SystemListener
    • gainFocus

      public void gainFocus()
      Specified by:
      gainFocus in interface com.jme3.system.SystemListener
    • loseFocus

      public void loseFocus()
      Specified by:
      loseFocus in interface com.jme3.system.SystemListener