Search code examples
androidroboguice

RoboGuice dependency Injection in a Fargment


i have been using RoboGuice dependency injection with a Activity and a Fragment Activity. But i cannot figure out how i can use it using a fragment as we dont call setContentview in the Fargment. Can anyone show me an example of how to use this ?

Kind Regards


Solution

  • Here's a post that describes the solution. Main steps are:

    1. Extend RoboFragment.
    2. Return a root View from onCreateView().
    3. Use @InjectView annotations the same way you do in RoboActivity.