PuzzleSDK
AppActivity.java
浏览该文件的文档.
1/****************************************************************************
2Copyright (c) 2015-2016 Chukong Technologies Inc.
3Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
4
5http://www.cocos2d-x.org
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in
15all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23THE SOFTWARE.
24****************************************************************************/
25package org.cocos2dx.cpp_tests;
26
27import android.os.Bundle;
28
29import org.cocos2dx.lib.Cocos2dxActivity;
30
31public class AppActivity extends Cocos2dxActivity {
32 @Override
33 protected void onCreate(Bundle savedInstanceState) {
34 super.setEnableVirtualButton(false);
35 super.onCreate(savedInstanceState);
36 // Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
37 if (!isTaskRoot()) {
38 // Android launched another instance of the root activity into an existing task
39 // so just quietly finish and go away, dropping the user back into the activity
40 // at the top of the stack (ie: the last state of this task)
41 // Don't need to finish it again since it's finished in super.onCreate .
42 return;
43 }
44 // DO OTHER INITIALIZATION BELOW
45
46 }
47}
void onCreate(Bundle savedInstanceState)