I have created an 'Enter PIN' screen. This pin activity will be called in onStart()
of activity A like this -
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
Log.d("pin", "on start 2");
if (MainActivity.flag) {
Intent intent = new Intent(con, PinActivity.class);
MainActivity.flag = false;
startActivity(intent);
}
}
However, I only want this activity to show up when user comes from background to foreground. Not when it comes from activity B (activity B comes after activity A).
This logic relies on this MainActivity.flag
's value, So I set it
true
inonStop()
so that pin screen show up while coming to foreground. and,- have put
flag = false
inonBackPressed()
of activity B, so that pin screen doesn't show up while coming from B to A.
But there is flaw in the logic, because pin screen shows up while coming from B to A, while it should not. (PS - Please ask me to clarify if you don't understand my question.)