Skip to content

Instantly share code, notes, and snippets.

View indi60's full-sized avatar
:octocat:
Fighting!

Agung Laksono indi60

:octocat:
Fighting!
View GitHub Profile
@glendmaatita
glendmaatita / ActivitiesStackHandler.kt
Last active May 20, 2021 04:05
Android - Activities Stack Handler
// Manually handle activity stack
// Android has many different mechanism on how to handle activities stack on each version
// Instead rely on native tool, we create this class to handle the stack
//
// How does it work?
//
// Make sure all of your activities is inherited from a `BaseActivity`
// When an activity launched, call `super.onCreate()` method from `BaseActivity`
// `BaseActivity@onCreate` is simple, just call `addActivity(this)` method to add your activity to the stack
// Don't forget to remove it from stack, by calling `removeActivity(this)`, when the activity is destroyed