-
Notifications
You must be signed in to change notification settings - Fork 545
SpiceManager : Could not unbind from service #96
Comments
Hello Bobby, this bug seems to be related to this : http://stackoverflow.com/q/7581986/693752. Can you do the following to see if it solves the bug : @Override
public void onStop() {
if( spiceManager.isStarted() ) {
spiceManager.shouldStop();
}
} If so, I will update the samples and documentation of RS. Thanks for your interest in RoboSpice. |
Thanks for the quick reply. Unfortunately adding the In addition, I am not using the support library but only android.app.Fragment as I run my app only on > 4.0 devices. Here is a simple test case :
I hope it helps. |
Yes it does, definitely. It looks like the fragment is started and stopped very quickly at 10.18.15:936 and the binding occurs after the unbinding. Then a new binding occurs 10.18.16.025 and results in this and the previous binding to be successful. This cycle happens again on back button and that fails dramatically the second time. Do you use a fragment inflated from XML or created by code ? If the latter case, would you mind to post your fragment related code and its location in the activity ? Stéphane |
Hello Stephane, First of all, I would like to apologize for the late answer but I was a bit away from work :-) Finally, I found where does this issue come from... And I am quite embarrassed because the problem was totally related to my fragments lifecycle and not to RS. Indeed, on orientation change I misunderstood how Android worked and I was recreating my fragments whereas Android was already taking care of it. That's explained why everything was duplicated... So, thanks for shedding some light on my issue and I feel deeply sorry for the inconvenience this has caused you. |
Finally, I'm back again because with a proper implementation of fragments, I still hit the bug and I can happily say that adding:
Is the perfect solution :-) So now I'm feeling less stupid compared to my previous post. |
Hi again Bobby-Jackson, thx a lot for all the feedback on this issue. I just updated the fragment Again, this bug is related to a bad fragment life cycle inside Support As a complement, if people want to use r12 in their project then they can :
That should definitely solve this "bug" in RS until Support r12+ is Stéphane |
Fragment sample and start guide have been updated to reflect this issue. |
Why don't you move the if-clause into the shouldStop-method to save the RS-users some trouble? |
I agree that it would save trouble. Nevertheless, this is a support bug. Stéphane 2013/6/14 StingerAJ [email protected]
Stéphane NICOLAS, |
I am sorry, this bug still exists. I already use the code in Fragment: @Override
public void onStop() {
if( spiceManager.isStarted() ) {
spiceManager.shouldStop();
}
} Here is my code, initialize Fragment in Activity: SpiceManager in MainFragment @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
if (fm.findFragmentById(R.id.content_frame) == null) {
contentFragment = MainFragment.newInstance();
ft.add(R.id.content_frame, contentFragment);
}
// configure the SlidingMenu
menu = new SlidingMenu(this);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.menu_frame);
if (fm.findFragmentById(R.id.menu_frame) == null) {
ft.add(R.id.menu_frame, new SlidingMenuFragment());
}
ft.commit();
} But sometimes throw How to use it correctly in Fragment or other way (like start on Activity, not in Fragment)? I apologize my english. |
Your not calling super.onStop() |
@kjsolo Which version of RS are you using, it looks like this bug has been patched a while ago. |
I have the same problem, what's the last version? I want to update my build.gradle. Actually my version is 1.4.8. compile('com.octo.android.robospice:robospice-retrofit:1.4.8') Thanks in advance. The wiki says this: |
@DarthWendigo latest version is 1.4.11 |
@rciovati thanks! 👍 |
Hi guys,
I sometimes get this error:
java.lang.IllegalArgumentException: connection is null
The detailed logcat:
I only use the spiceManager.start() and the spiceManager.shouldStod() within Fragments.
Any ideas where does it come from or why does this happen?
The text was updated successfully, but these errors were encountered: