I have app with 3 activities.
- Main Activity A
- Side Activity B
- Side Activity C
From Main Activity I can go directly to B and C as well. All moves looks like that:
A->B->C
A->C
A->B
Ofc when I want go back when I'm in C I need to know that I came from A or B and then back to proper one. And that casues me some trobule.
When I go to C acitivity through B, and then back to B onPause
is called twice. The point is that when I back like that I need to call recreate
(language change)
In C I have variable which tells me that I go from A or B.
Code in C
public void onClick(View v) {
if (v.getId() == R.id.back_button) {
if(from_B)
{
onBackPressed();
}
else
{
goes_to_A();
}
}
Code B
@Override
protected void onResume() {
super.onResume();
if(from_B)
{from_B = false;
recreate();}
So when I go back to B like that lifecycle looks like: OnResume
-> then I call recreate();
-> onPause
-> onCreate
-> onResume
-> onPause
! and that last onPause is strange because app should normally work after last onResume. It gives me later errors like
Performing pause of activity that is not resumed
what's wrong with that ?