https://kotlinlang.org logo
#anko
Title
# anko
b

blakelee

03/26/2017, 6:21 AM
How do you add a fragment to an activity? I'm trying to add caldroid. I tried using 'FragmentActivity().supportFragmentManager.beginTransaction().replace(R.id.calendar_view, CalendarFragment()).commit()' That's inside my onCreate method for my activity. It keeps giving me 'java.lang.IllegalStateException: Activity has been destroyed'
m

miha-x64

03/26/2017, 9:26 AM
FragmentActivity()
is a constructor call, you creating a new one. Use just
supportFragmentManager.(...)
.
b

blakelee

03/26/2017, 11:19 PM
Thank you :)
3 Views