나는 내 응용 프로그램에 시작 화면을 추가하고 내 코드는 다음과 같습니다초기 화면 활동
내 매니페스트public class SplashActivity extends AppCompatActivity {
public static final int DELAY_MILLIS = 2000;//for testing i use 5 seconds
private Handler handler = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, CurrencyExchangeActivity.class);
startActivity(intent);
finish();
}
}, DELAY_MILLIS);
}
@Override
protected void onStop() {
super.onStop();
handler.removeCallbacksAndMessages(null);
}
}
: 나는 경우
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vdovin.currencyratesapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".application.CurrencyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".screens.splash.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".screens.main.CurrencyExchangeActivity">
</activity>
</application>
</manifest>
그래서 내가 다음 문제에 직면 스플래시 화면을로드 할 때 홈 버튼으로 내 앱을 숨긴 다음 앱을 다시 열면 스플래시 화면 액티비티가
CurrencyExchangeActivity
으로 전화하지 않습니다. 메소드
onCreate()
이 한 번만 호출 되었기 때문에 나타납니다. 그러나 앱을 다시 열면 스플래시 화면이 다시 표시되기 때문에
onResume()
에 넣을 수 없습니다. 하지만 Google의 앱 (지도, 시트 등 ...)과 같이
CurrencyActivity
을 표시하고 싶습니다.
도 –