If the browser gets opened, The first method that will be called from activity is onPause()
followed by onStop() i.e. the activity will be paused and then stopped. Check if method onStop()
get called or not alternatively save a Boolean
and change its state in onSop()
method and check its state in onRestart() method this way you will get to know whether browser is opened or not.
like this
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
System.out.println("STOP");
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
System.out.println("onRestart");
// check the value of boolean here
}