Question

I am trying out RoboGuice-Sherlock in a application. I wrote a custom Binding that uses a provider.

public class ActionBarProvider implements Provider<ActionBar>{

   @Override
   public ActionBar get() 
   {
         return new SherlockFragmentActivity().getSupportActionBar();
   }
} 


public class MyModule implements Module{

   @Override
   public void configure(Binder binder) 
   {
        binder.bind(ActionBar.class).toProvider(ActionBarProvider.class);
   }
}

Following the documentation I register the module but now I am having a cannot resolved type error.

 The method newDefaultRoboModule(Application) in the type RoboGuice is not applicable for the arguments (LoginAndRegistrationActivity)

public class LoginAndRegistrationActivity extends RoboSherlockFragmentActivity{
@InjectView (R.id.login_reg_pager) 
private ViewPager viewPager;

@Inject private FragmentManager fragmentManager;
@Inject private ActionBar actionBar;

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    RoboGuice.setBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE,
            RoboGuice.newDefaultRoboModule(this),new RoboGuiceModule());

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

}

}

What am I doing wrong and how can I resolve this problem?

Was it helpful?

Solution

RoboGuice.newDefaultRoboModule() is expecting an Application, not an Activity

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top