Closed GoogleCodeExporter closed 9 years ago
What particular issue if using RoboGuice with Android Binding you encountered?
I haven't really tried that out, but if that works with AB, then there's no
point to develop my own.
Original comment by gueei....@gmail.com
on 25 Jun 2011 at 6:10
RoboGuice works fine. You have to merge BindingActivity + RoboGuice Activity to
your own base activity.
Original comment by egandro
on 30 Dec 2011 at 9:09
Add the following JARs to your project:
android-support-v4.jar, guice-3.0-no_aop.jar, javax.inject.jar,
roboguice-2.0b3.jar (check the roboguice homepage for more informations).
Also add the androidbinding.jar for our framework.
This is the RoboActivity:
http://code.google.com/p/roboguice/source/browse/roboguice/src/main/java/robogui
ce/activity/RoboActivity.java
-- RoboBindingActivity.java -- (is derived from BindingActivity - instead of
the android Activity).
public class RoboBindingActivity extends BindingActivity {
protected EventManager eventManager;
@Inject ContentViewListener ignored; // BUG find a better place to put this
@Override
protected void onCreate(Bundle savedInstanceState) {
final RoboInjector injector = RoboGuice.getInjector(this);
eventManager = injector.getInstance(EventManager.class);
injector.injectMembersWithoutViews(this);
super.onCreate(savedInstanceState);
eventManager.fire(new OnCreateEvent(savedInstanceState));
}
@Override
protected void onRestart() {
super.onRestart();
eventManager.fire(new OnRestartEvent());
}
@Override
protected void onStart() {
super.onStart();
eventManager.fire(new OnStartEvent());
}
@Override
protected void onResume() {
super.onResume();
eventManager.fire(new OnResumeEvent());
}
@Override
protected void onPause() {
super.onPause();
eventManager.fire(new OnPauseEvent());
}
@Override
protected void onNewIntent( Intent intent ) {
super.onNewIntent(intent);
eventManager.fire(new OnNewIntentEvent());
}
@Override
protected void onStop() {
try {
eventManager.fire(new OnStopEvent());
} finally {
super.onStop();
}
}
@Override
protected void onDestroy() {
try {
eventManager.fire(new OnDestroyEvent());
} finally {
try {
RoboGuice.destroyInjector(this);
} finally {
super.onDestroy();
}
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
final Configuration currentConfig = getResources().getConfiguration();
super.onConfigurationChanged(newConfig);
eventManager.fire(new OnConfigurationChangedEvent(currentConfig, newConfig));
}
@Override
public void onContentChanged() {
super.onContentChanged();
RoboGuice.getInjector(this).injectViewMembers(this);
eventManager.fire(new OnContentChangedEvent());
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
eventManager.fire(new OnActivityResultEvent(requestCode, resultCode, data));
}
}
Original comment by egandro
on 2 Jan 2012 at 8:30
Original comment by gueei....@gmail.com
on 3 Jan 2012 at 1:57
Great! Thanks so much!!!
Original comment by shivkuma...@gmail.com
on 6 Jan 2012 at 3:18
Original issue reported on code.google.com by
shivkuma...@gmail.com
on 5 Jun 2011 at 1:43