get String with arguments

This commit is contained in:
Ilia Kurtov 2016-11-09 14:46:41 +03:00
parent db07f8766b
commit f43bd0c6e3
1 changed files with 12 additions and 0 deletions

View File

@ -422,6 +422,18 @@ public abstract class ObservableCollectionAdapter<TItem, TItemViewHolder extends
return itemView.getContext().getString(stringRes);
}
/**
* Simply get String from resources with arguments.
*
* @param stringRes String resource id;
* @param formatArgs The format arguments that will be used for substitution;
* @return Requested String that matches with provided string resource id.
*/
@NonNull
public String getString(@StringRes final int stringRes, final Object... formatArgs) {
return itemView.getContext().getString(stringRes, formatArgs);
}
}
}