【发布时间】:2017-02-21 22:50:20
【问题描述】:
在 MVP 模式中,我的字符串具有动态值 %
例子:
<string name="hello">%s hello</string>
我需要在我的 textview 上用“我的名字”设置这个文本,我将如何在没有引用的情况下在我的演示者层上直接使用 R.String。
public void onItemClicked(String name) {
if (mainView != null) {
//HOW use R.string.hello from Strings here? [presenter layer]
mainView.showMessage(String.format("%s hello", name));
}
}
在 MVP 模式中,我无法在演示者层中引用任何 Android 类,我在此类中没有任何上下文,但我需要使用 R.string.hello,因为翻译,我怎么能接受这个破坏这个 MVP 模式
【问题讨论】: