above logic seems kind of duplicated code there, i would rewrite as if I understanding is correct.
```
if (fragment != null && fragment instanceof XWalkViewSectionFragment) {
    mActiveView = ((XWalkViewSectionFragment)fragment).getXWalkView();
} else {
    mActiveView = null;
}
```