【解决方案】Android第一次安装程序挂起再进入崩溃问题

场景还原:Creator构建编译生成的android程序,手机第一次安装,home键返回桌面,再次点击程序图标程序崩溃
解决方法:
在在Cocos2dxActivety里的onCreate方法里的super.onCreate(saveInstanceState)后面加上:

if(!this.isTaskRoot()) { 
    Intent mainIntent=getIntent();
    String action=mainIntent.getAction();
    if(mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
        finish();
        return;
     }
}

http://blog.csdn.net/potato47/article/details/70169481

1赞