Dependcies/Object state are not properly after coming back from sleep mode. - May be an injection problem

100 views
Skip to first unread message

Ishan Dave

unread,
Jun 5, 2014, 3:51:30 AM6/5/14
to robo...@googlegroups.com
In our app has issues when coming back from sleep mode, and in those cases roboguice implementation is not properly initialized, so all kinds of weird issues happen after this point.

Generally, if we have crash or exception in app, we restarts the activty and then the dependencies are not available to the app. Following, stackstrace may help to identify the issue:
05-09 02:38:26.764: E/AndroidRuntime(14276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.somepackage/com.somepackage.view.GalleryActivity}: java.lang.IllegalStateException: Derived class did not call super.onRestoreInstanceState()
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread.access$800(ActivityThread.java:138)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.os.Handler.dispatchMessage(Handler.java:102)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.os.Looper.loop(Looper.java:136)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread.main(ActivityThread.java:5050)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at java.lang.reflect.Method.invokeNative(Native Method)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at java.lang.reflect.Method.invoke(Method.java:515)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at dalvik.system.NativeStart.main(Native Method)
05-09 02:38:26.764: E/AndroidRuntime(14276): Caused by: java.lang.IllegalStateException: Derived class did not call super.onRestoreInstanceState()
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.view.View.dispatchRestoreInstanceState(View.java:12801)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2637)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.view.View.restoreHierarchyState(View.java:12777)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.Fragment.restoreViewState(Fragment.java:613)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:910)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1853)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.Activity.performCreate(Activity.java:5234)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
05-09 02:38:26.764: E/AndroidRuntime(14276): 	... 11 more
05-09 02:38:28.964: I/Process(14276): Sending signal. PID: 14276 SIG: 9
05-09 02:38:29.084: D/PiCamApplication(14333): PiCamApplication update Sync Status
05-09 02:38:29.094: I/dalvikvm(14333): Could not find method com.google.inject.Injector.getAllBindings, referenced from method roboguice.inject.ContextScopedRoboInjector.getAllBindings

We created a CoreActivty that extends the RoboguiceActivty.
GalleryActivity extends CoreActivity and we did all the injection in GalleryActivty.

Is thare a way to initialize the RoboguiceContext at Application Level by subclassing Application class? At present our injection is inside Activity. Please help to find a proper solution for this issue.

Thanks a lot in advance!
Reply all
Reply to author
Forward
0 new messages