이유가 파악되지 않는 문제가 있습니다.스플래시 화면에서 홈 버튼을 누른 후 몇 초 후에 Android 앱이 열림
앱을 실행하면 스플래시 화면이 처음 2.5 초 동안 표시되어 새로운 활동을 마치고 시작합니다. 이 시간 동안 집 또는 뒤로 버튼을 누르면 응용 프로그램이 정상적으로 닫힙니다. 그러나 몇 초 (2.5 이상)가 지나면 앱이 시작 화면 뒤의 활동에서 열리고 시작됩니다.
왜 이런 일이 발생하는지에 대한 도움을 주시면 감사하겠습니다. 여기
는 시작 화면의 구현 (나는 다른 구현을 시도했습니다 나는 그러나 아무것도 여기에이 문제를 일으키는 생각하지 않는다)`public class SplashScreenActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
Thread myThread = new Thread(){
@Override
public void run() {
try {
sleep(2500);
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
startActivity(intent);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
myThread.start();`
여기에 매니페스트
<?xml version="1.0" encoding="utf-8"?>
입니다입니다
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode = "singleInstance">
</activity>
<activity android:name=".activities.SplashScreenActivity"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".alert.BroadCaster" >
</receiver>
<service android:name=".timer.TimerService"
android:process=":timerservice" />
</application>
http://stackoverflow.com/a/5486970/6017001 –
좋은 질문, 축하해. – statosdotcom