私は「A」というアクティビティと「B」という別のアクティビティを持つアプリを開発しています。私は "A"から "B"の間を移動する意図を使用しましたが、私のアプリがバックグラウンドになると、Intent
はまだ動作します。
アプリが一時停止状態になると、「A」から「B」への移動が停止します。どうすればいいですか?アクティビティがアンドロイドで一時停止状態になったときにインテントを停止する方法はありますか?
public class CSplashScreen extends AppCompatActivity {
// Splash screen timer
private static final int m_n_SplashTimeOut = 4000;
private ImageView splash_image;
private boolean isConnected;
private static CLoginSessionManagement s_oCloginSession;// refernce of loginsession management
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
if (NetworkUtil.isConnected(getApplicationContext())){
}else {
CSnackBar.getInstance().showSnackBarError(findViewById(R.id.mainLayout), "No internet connection available", getApplicationContext());
}
init();//initialize controls
}
private void init() {// initialize controls
Animation animation = null;
splash_image = (ImageView) findViewById(R.id.splash_image);
animation = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.zoom_out);
animation.setDuration(1500);
splash_image.startAnimation(animation);
new Handler().postDelayed(new Runnable() {
// This method will be executed once the timer is over
@Override
public void run() {
Intent i = new Intent(CSplashScreen.this, CMainActivity.class);
startActivity(i);
}
}, m_n_SplashTimeOut);// spalsh screen timing
}
}あなたが.. 'isPauch' のような旗を持ってonPause(中でそれが本当作る)とonResumeで、それは偽にすることができ
あなたは、AからBへのナビゲーションがあなたのアプリでユーザー生成されていないことを意味しますか?それはAsyncTaskからですか? –
この「意図」をいつどこで使用しますか? –
これをチェックしてくださいhttp://stackoverflow.com/questions/5446565/android-how-do-i-check-if-activity-is-running –