Rektirino
Rektirino

Reputation: 582

onPause() called before onResume() in BaseActivity

I have 2 activites A and B. Both of them extend BaseActivity. Activity A is the launcher activity. From A when I click a button, it goes to Activity B. But I found something weird and I don't know if it is normal. According to the activity lifecycle, onResume() is called before onPause(). But when I am on Activity B, the baseActivity first pauses and then resumes. Not only that as I press the back button and reach Activity A, the baseActivity pauses, resumes and then destroys. I still can't understand why. Maybe this is a noob question but I'm curious and I couldn't find any answers online. Hope you guys can help me!

Upvotes: 1

Views: 493

Answers (1)

FOliveira
FOliveira

Reputation: 556

I think the onPause came from you first activity and then the OnResume is form the second ... But since they both extends from your BaseActivity you will probably see your base activity events from that order but they are different instances of your BaseActivity

Just to be clear, you have two activities

ActivityA -> BaseActivity

ActivityB -> BaseActivity

If you Log you BaseActivity you will catch events from both activities because they are different instances of BaseActivity and not the same

Upvotes: 1

Related Questions