1
roboguice 위키의 Simple Example은 Inject
을 사용하여 LocationManager
인스턴스를 액티비티에 삽입 할 수 있음을 보여줍니다. 그러나이 예가 작성된 이후 API가 변경된 것 같습니다. 모든 패키지에서 Inject
을 찾을 수 없습니다. 최신 roboguice 2.0 API로 내 활동에 LocationManager
을 삽입 할 수 있습니까? 여기 roboguice 2.0에 LocationManager를 삽입하려면 어떻게해야합니까?
class RoboWay extends RoboActivity {
@InjectView(R.id.name) TextView name;
@InjectView(R.id.thumbnail) ImageView thumbnail;
@InjectResource(R.drawable.icon) Drawable icon;
@InjectResource(R.string.app_name) String myName;
@Inject LocationManager loc;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
name.setText("Hello, " + myName);
}
}