Open CNdev16 opened 3 years ago
I also get the same issue. Only for the first time. The library is very good. I could change any language on my app. But I got this issue. Hope you fix it soon. Ver 1.2.10 and Android 7.0
@akexorcist i'm facing same issue. App crashes for first time.
@akexorcist I found the scenario. if I change locale after retuning a different locale from getDefaultLanguage(base: Context). (for very first time)
any one have solution for this. The same issue here
@Stupidman22 @huunhan18pro @CNdev16 I resolved this issue.
You have to create a webview instance (programmatically) and destroy it. (just do it in on create). Find the helper class in the below link.
Not sure why it behaves like this. but it solved my problem.
Crash happens only if you inflate a webview via XML (first instance). Not sure, but maybe it is something to do with not refreshing application context after language change.
Please let me know if it resolves your issue.
Thank you so much. I will apply it 😁
On Sun, Jun 6, 2021, 22:44 nagesh-kashyap-r @.***> wrote:
@Stupidman22 https://github.com/Stupidman22 @huunhan18pro https://github.com/huunhan18pro @CNdev16 https://github.com/CNdev16 I resolved this issue.
You have to create a webview instance (programmatically) and destroy it. (just do it in on create). Find the helper class in the below link.
Not sure why it behaves like this. but it solved my problem.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/akexorcist/Localization/issues/114#issuecomment-855419073, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAGR55665YZZC7J44HLS6LTROJV5ANCNFSM45OXTLCQ .
The problem cause when using web view and override this function at application override fun getDefaultLanguage(): Locale { return Locale.getDefault() } --> any one try to reproduce and fix issue pls. I think this is critical issue
@Stupidman22 I solved the exact same issue by just creating an WebView() object.
Like WebView(context).destroy() ->> in onCreate() of activity
Did you try this?
@nagesh-kashyap-r : In my case the webview is Native ads of google. It load in activity first time. I try to using your solution. But it FC. I think I did something wrong :( ...
This issue was fixed in 1.2.11. Please check it out
Since AndroidX AppCompat has per-app language preferences for backward compatibility. Please migrate this library to AndroidX for more stability, compatibility, and longer support from Google team.
Thank you for your support
App crashes first time using web view after setting a new language in the application. แอพจะแครชกรณีใช้งาน webview ครั้งแรกหลังจาก start app -> set language in app ครับ
ref: