Skip to content

Instantly share code, notes, and snippets.

@MartuPuri
Created October 12, 2017 20:07
Show Gist options
  • Save MartuPuri/7fec905b75d50bee603f385058056a7f to your computer and use it in GitHub Desktop.
Save MartuPuri/7fec905b75d50bee603f385058056a7f to your computer and use it in GitHub Desktop.
Kotlin Extension - FragmentActivity
fun FragmentActivity.initialFragment(fragment: Fragment,
@IdRes fragmentContentId: Int) {
val fragmentManager = supportFragmentManager
val fragmentTransaction = fragmentManager.beginTransaction()
fragmentTransaction.add(fragmentContentId, fragment).commit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment