https://kotlinlang.org logo
#feed
Title
# feed
y

Yev Kanivets

08/16/2021, 6:49 AM
@Daniel Kunis [JB] here is an approach I was talking about
👀 1
j

Joost Klitsie

08/16/2021, 8:30 AM
If you visit the page https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String) you can read
Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
☝️ 1
So I am not so sure this is the best solution
But a very doable solution and I guess in many cases shouldn't give an actual performance impact
y

Yev Kanivets

08/16/2021, 8:39 AM
Yes, totally depends on your needs.
a

alex009

08/16/2021, 8:47 AM
y

Yev Kanivets

08/16/2021, 8:50 AM
Doesn't work for us because we already have our strings provided by native modules with 3rd party integrations for translations. Shortly, we don't want to share strings between iOS and Android, but access some of them in KMM modules.
🤔 1
a

Adam Powell

08/16/2021, 1:54 PM
Don't look up Android resource identifiers by string name. It's slow enough that it shouldn't be used in anything more than debug utilities or toy apps. The comment is downplaying the inefficiency.
3 Views