When are @InjectView fields introduced?

Exactly when are there fields Activitythat are annotated with @InjectViewor @InjectResourceentered?

+5
source share
1 answer

According to a simple example on the Roboguice website, members are filled by the time they super.onCreate()were called from Activity onCreate():

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 ); 
    } 
}
+7
source

All Articles