Reputation: 45
How we can access UI elements of a fragment in oncreateview, as onCreateView is called before onActivity created?
Upvotes: 0
Views: 44
Reputation: 20147
You should be inflating your UI elements within onCreateView
, so they should be accessible there. As long as you're only accessing UI elements within your Fragment
, it's safe to inflate and use them at that point - you don't need to wait for onActivityCreated
or anything like that.
Upvotes: 1