I'm trying to realize functionality for login launched activities names. I don't want to add checking in every activity. Short time ago i saw that it's possible to realize something like "activity lifecycle manager" inside application and catch callbacks like activityCreated(...)
or activityDestroyed(...)
. But unfortunately i forgot the exact name of that method/interface(i don't even remember what was that :( ) and i didn't manage to find something similar here.
So, can somebody tell me how can i achieve this?
You can extend the Application
class and implement the ActivityLifecycleCallbacks
interface:
public class MyApplication extends Application implements ActivityLifecycleCallbacks {
// Various activity callbacks here
}
You can read about the callbacks here.
The above class will need to registered in the <application>
tag of your manifest file under android:name:""
property as android:name:"MyApplication"
.