3
在RoboGuice例子有两种不同的方式来注入的东西Roboguice注入和Provider类
@Inject
protected LayoutInflater inflater;
@Inject
protected Provider<LayoutInflater> inflater2;
什么是他们和什么样的方式,当我需要选择有什么区别?
在RoboGuice例子有两种不同的方式来注入的东西Roboguice注入和Provider类
@Inject
protected LayoutInflater inflater;
@Inject
protected Provider<LayoutInflater> inflater2;
什么是他们和什么样的方式,当我需要选择有什么区别?
您需要提供者注入几个smth实例。例如,每行用户的行为。当你知道你想要什么和你的欲望的大小时,使用直接注射。
提供商是一种织物,在你的代码注入