The Simple Example on the roboguice wiki shows that you can use Inject to inject a LocationManager instance into an Activity. However, it appears that the API has changed since this example was written. I cannot find Inject in any of the packages. Is there a way to inject a LocationManager into my activity with the latest roboguice 2.0 API?
Here is the example code for reference:
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 );
}
}
The 2.0 Documentation states that you must add the
Guice 3.0-no_aopJAR file to your application. That is where theInjectannotation is defined.