Aness Iqbal
12/29/2020, 4:09 PMApp.context.getString(R.string.rupees, min.toString())
But with application context static reference like that I am not able to change the strings based upon locale. How should update the app context or restart the whole app? Can anyone help?Dean Djermanović
12/29/2020, 4:12 PMAness Iqbal
12/29/2020, 4:14 PMDean Djermanović
12/29/2020, 4:18 PMAness Iqbal
12/29/2020, 4:25 PMfun priceRange(): String {
// Return 1 price if min & max is same
if (min == max) {
return "${App.context.getString(R.string.rupees, min.toString())}"
}
}
One option is to pass the context as param of function from the calling activity or fragment. But I will then have to add it all over the places in code. Can I updated or reset app context to get latest resources when Locale is changed?Adam Powell
12/29/2020, 4:27 PMDean Djermanović
12/29/2020, 4:34 PMmin
and max
data in the model class and then create that string in the Activity/Fragment
or in the Presenter/ViewModel
if you’re using any architectural pattern?Aness Iqbal
12/29/2020, 4:37 PMJorge Gomez
12/29/2020, 11:02 PM