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

Use activity context for Toast.makeText #2670

Merged
merged 1 commit into from May 20, 2024
Merged

Conversation

g-jiannan
Copy link
Contributor

It is problematic to use application context for UI use case since Android 31. And it will cause StrictMode violation (see detectIncorrectContextUse).

@CLAassistant
Copy link

CLAassistant commented May 10, 2024

CLA assistant check
All committers have signed the CLA.

@g-jiannan
Copy link
Contributor Author

g-jiannan commented May 10, 2024

https://developer.android.com/guide/topics/ui/notifiers/toasts once recommended using Application or Activity but later changed to Activity only: https://r.android.com/2597393.

Since RequestPermissionActivity invokes finish() immediately after Toast.makeText, I'm not pretty sure if this PR is valid. Maybe it is inappropriate to use toast in this case.

@pyricau
Copy link
Member

pyricau commented May 20, 2024

Thanks!

@pyricau pyricau merged commit 8986f34 into square:main May 20, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants