在MVP模式,我有串动态值%从资源上层演示使用字符串“R.String” 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,因为翻译,我怎么可以借此witouth废除此MVP模式
Thx如此之多,并且使用该逻辑不能在我的演示者中使用类似showmessage(getview(R.id.text),text)的东西,因为R类是正确的吗? – rcorbellini
我从来没有尝试过这种方法,但它可能工作,但我不会建议它。再次单元测试时,你的单元测试对R类没有任何理解 –