I have method that gets a list (listOf(1, 5, 10, 15, 30)) and TimeType (MINUTES or HOURS) as parameters. And I have to use plurals for MINUTES so that if I choose 1 I get "minute" and if I choose 5 or 10 I get "minutes". But I have problems with that. Could you please help me?
val title = when(type){
TimeType.MINUTES -> R.string.time_minutes
TimeType.HOURS -> R.string.time_hours
}
title = String.format(getString(title), interval)
<plurals name="amountOfMinutes">
<item quantity="one">@string/minute</item>
<item quantity="other">@string/minutes</item>
</plurals>
Upd.
I tried to use it like that but the problem is that val title should be int but in my case it becomes Any and getString in format dosn't accept it.
val title = when(type){
TimeType.MINUTES -> for (i in intervals){
resources.getQuantityString(R.plurals.amountOfMinutes, i, i)
}
TimeType.HOURS -> R.string.options_for_reminder_time_hours
}