Skip to content

Instantly share code, notes, and snippets.

@abircse
Created February 15, 2021 13:42
Show Gist options
  • Save abircse/ea9589ef55d8db4716f53f053385f16c to your computer and use it in GitHub Desktop.
Save abircse/ea9589ef55d8db4716f53f053385f16c to your computer and use it in GitHub Desktop.
FragmentControllerExtension
object BaseFragmentController {
fun load(fragment: Fragment, framelayout: Int, context: Context) {
val transaction = (context as FragmentActivity).supportFragmentManager.beginTransaction()
transaction.replace(framelayout, fragment, fragment::class.java.name)
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
transaction.addToBackStack(null)
transaction.commit()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment