当我连接到chromecast时,重新启动应用程序并与chromecast断开连接,那么我将无法重新连接到chromecast。当我单击MediaRouteButton时,我得到 “ onSaveInstanceState之后无法执行此操作”。
06-28 10:23:13.628 27950-27950 / fr.bouyguestelecom.tv.android E / com.tapptic.btv:之后无法执行此操作 onSaveInstanceState
java.lang.IllegalStateException:之后无法执行此操作 onSaveInstanceState 在 android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2044) 在 android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2067) 在 android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:680) 在 android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:634) 在android.support.v4.app.DialogFragment.show(DialogFragment.java:143) 在 android.support.v7.app.MediaRouteButton.showDialog(MediaRouteButton.java:255) 在 android.support.v7.app.MediaRouteButton.performClick(MediaRouteButton.java:304) 在 com.tapptic.bouygues.btv.cast.view.BtvMediaRouteButton.performClick(BtvMediaRouteButton.java:41) 在android.view.View $ PerformClick.run(View.java:23645) 在android.os.Handler.handleCallback(Handler.java:751) 在android.os.Handler.dispatchMessage(Handler.java:95) 在android.os.Looper.loop(Looper.java:154) 在android.app.ActivityThread.main(ActivityThread.java:6692) 在java.lang.reflect.Method.invoke(本机方法) 在 com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1468) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
我的MediaRouteButton类:
public class BtvMediaRouteButton extends MediaRouteButton {
@Setter
BtvMediaRouteButtonInterface btvMediaRouteButtonInterface;
private boolean supressOthers;
public BtvMediaRouteButton(Context context) {
super(context);
}
public BtvMediaRouteButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BtvMediaRouteButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean performClick() {
try {
if (btvMediaRouteButtonInterface != null) {
btvMediaRouteButtonInterface.castVideo();
return super.performClick();
}
return super.performClick();
}catch (IllegalStateException e){
Logger.error(e);
return false;
}
}
@Override
public void setVisibility(int visibility) {
if (!supressOthers) {
super.setVisibility(visibility);
}
}
public void setVisibility(int visibility, boolean suppressOthers) {
this.supressOthers = false;
setVisibility(visibility);
this.supressOthers = suppressOthers;
}
}