Fix exception when switching between android app and other apps