Accessing the Activity from a Fragment

前端 未结 2 550
逝去的感伤
逝去的感伤 2021-01-13 04:24

I\'m trying to change the activity title from a fragment (in this case, it\'s an android.support.v4.app.Fragment). To this end, I save the activity in an attrib

2条回答
  •  孤街浪徒
    2021-01-13 04:33

    Nowadays you can call requiredActivity() too that return FragmentActivityobject and if fragment doesn't come from an Activity, method throws a IllegalStateException

提交回复
热议问题