transientResource

Creates an anonymous instance of ResolvableString.Resource, which is a ResolvableString backed by Android resource string with optional arguments. Arguments can be ResolvableStrings as well.

This factory is meant to create only transient strings, i.e. not persisted in storage. For persisted strings ResolvableString.Resource should be explicitly subclassed. Example:

object InstallMessageTitle : ResolvableString.Resource() {
override fun stringId() = R.string.install_message_title
private const val serialVersionUID = -1310602635578779088L
private fun readResolve(): Any = InstallMessageTitle
}

class InstallMessage(fileName: String) : ResolvableString.Resource(fileName) {
override fun stringId() = R.string.install_message
private companion object {
private const val serialVersionUID = 4749568844072243110L
}
}

Parameters

stringId

Android string resource ID

args

string format arguments