Skip to content
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

ns::android::showToast crash #8

Open
Madour opened this issue Sep 12, 2021 · 0 comments
Open

ns::android::showToast crash #8

Madour opened this issue Sep 12, 2021 · 0 comments
Labels
android bug Something isn't working

Comments

@Madour
Copy link
Owner

Madour commented Sep 12, 2021

Calling ns::android::showToast from main will cause crash with exception : "Can't toast on a thread that has not called Looper.prepare()" (here). This happens because the main thread looper is not found (I think ?) when creating the Toast message.

Attempted to use the ALooper solution with no success because we don't have access to the main thread from the SFML Activity unfortunately.

In fact, SFML sets the looper from initializeMain which is called from the custom android main, which itself is ran in new thread.

Possible Solution : access main looper from Java's static method Looper.getMainLooper and then make the JNI showToaster call from there.

The other solution would be to completely replace sfml-activity by nasnas-activity and call ALooper_prepare from the activity main thread, and setup a pipe to communicate with it.

@Madour Madour added the bug Something isn't working label Sep 12, 2021
@Madour Madour added the android label Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant