I am developing an app in which I have activity called "A" and another activity called "B". I used intent to navigate between "A" to "B", but when my app goes in background Intent still works.
What I want when app goes in pause state stop navigating from"A" to "B".How can I do that?
Here is code:
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
}
}
 
     
    