-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: include FragmentActivity example on Android #47
Comments
Sorry for my late reply... I don't do much Android development, and haven't done anything with fragments. A template might be good, but I'm not sure I should be the one to write it, since I am not at all confident with some of the Android-specific code. If you have or can extract a skeleton project from your code, and can post it here, I could probably get that into a template. Or you could submit a PR, either way would be appreciated. I'm kind of lost with the FragmentActivity code in the wiki; I really haven't done much Android dev at all. |
Hi, so basically in
where
the class name in I think there should also be an additional dependency in the I hope I have provided sufficient information, it is a bit difficult for me to submit a PR since I don't know how the template works here. |
In my kotlin project, libgdx is used for client graphical interface, where the main game logic is launched and ran by kotlin coroutine. This is pretty straightforward for desktop, but not so much for Android. I spent some time to realize that I can use lifecycleScope for Android (https://developer.android.com/topic/libraries/architecture/coroutines#lifecyclescope).
However, the android template generated by this wizard and some other open source projects that I referred to rely on the default
AndroidApplication
class, and I spend a pretty long time to realize that this doesn't work nicely with lifecycleScope. Where a simpleAndroidFragmentApplication
withFragmentActivity
(https://github.com/libgdx/libgdx/wiki/Starter-classes-and-configuration#game-fragment) works flawlessly in my case.Therefore, I suggest that including a template of
FragmentActivity
may help other people to set things up quicker.The text was updated successfully, but these errors were encountered: