rCorbellini
04/05/2018, 12:24 PMjishindev
04/06/2018, 5:55 AMfun foo(resId: Int? = null, str: String? = null): String? {
if (resId != null) return context.getString(resId)
return str
}
And call it like foo(R.string.name)
or foo(str ="Name")
. Don’t quite think it makes sense for the case of string resources but enough to understand the concept.