上のコードでスプラッシュ画面を作成しているのですが
Xperiaの端末複数で
ホームボタンから戻り、再度アプリアイコンをタップして起動したときに
もう一度スプラッシュ画面が起動してしまいます
雑ですがその下のコードでrunnableを走らせないと直ります。
何の要因で起こっているのかわからないので教えてください。
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class BootActivity extends Activity implements Runnable { private Handler mHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); mHandler = new Handler(); } @Override protected void onResume() { mHandler.postDelayed(this, 2000); super.onResume(); } @Override protected void onPause() { super.onPause(); mHandler.removeCallbacks(this); } void launch() { Intent intent = new Intent(this, SearchTop.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade); finish(); } @Override public void run() { launch(); } }
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class BootActivity extends Activity implements Runnable { private Handler mHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); Intent intent = new Intent(this, SearchTop.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade); finish(); } @Override protected void onResume() { mHandler.postDelayed(this, 2000); super.onResume(); } @Override protected void onPause() { super.onPause(); mHandler.removeCallbacks(this); } void launch() { Intent intent = new Intent(this, SearchTop.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade); finish(); } @Override public void run() { launch(); } }