4

In RoboGuice examples there are two different ways to inject something

@Inject
protected LayoutInflater inflater;

@Inject
protected Provider<LayoutInflater> inflater2;

What's the difference between them and what way and when i need to choose?

4

1 回答 1

2

您需要提供者注入多个 smth 实例。例如,每个用户的操作对应一行。当你知道你想要什么和你的欲望大小时,就会使用直接注入。

Provider 是一种结构,它注入你的代码

于 2012-09-17T07:09:54.647 回答