简体   繁体   中英

Launch LibGDX screen from Android Activity

  • Context: I'm currently developing an Android Application containing different mini-games related to randomness, one of its requirements is to share the seed used by the pseudo-random generator to generate an initial state of the game. Also I'm using some Android services and permissions, like Internet and camera to share the seed (using QR for example).
  • Question: I want to know if its possible to launch a LibGDX screen from an Android Activity and how, with an example if possible. I tried to find examples, but there are answers from like four years ago, and some things have changed. If isn't possible, I need to know if I can do the opposite (create a LibGDX game from the scratch, recreating the menu and all the stuff) without losing access to the services and permissions, to launch the camera to recognize QR for example.
  • I asked the same question in the LibGDX forum two weeks ago, but nobody answered. If its too complicated, do you have any suggestion? like changing framework or something else? I've been thinking switch to Unity, because the documentation, but I'm not sure. Thanks a lot!

From Any Native Activity to LibGDX Activity :

Yes, It is possible to launch a LibGDX screen from an Android Activity .

AndroidLauncher.java is a launcher Activity of LibGDX and In Android you can move from one activity to another using Intent .

intent = new Intent(this, AndroidLauncher.class);
startActivity(intent);

From LibGDX Screen to any Native Activity :

Any Screen of LibGDX is nothing more than a View of AndroidLauncher activity. You need to use interfacing to call android specific APIs and move to another Activity.

You need to maintain OpenGL Context Loss.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM