Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • briar briar
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 788
    • Issues 788
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • briar
  • briarbriar
  • Issues
  • #631

Closed
Open
Created Sep 01, 2016 by akwizgran@akwizgranOwner

Inject fragments earlier in their lifecycle

Fragments are injected in Fragment#onActivityCreated(), which is called after Fragment#onCreate() and Fragment#onCreateView(), meaning injected fields can't be used in those methods. It would sometimes be useful to have access to injected fields earlier in the fragment's lifecycle.

Injection happens at this point because BaseActivity creates its ActivityComponent in Activity#onCreate(). Would it be possible for BaseFragment to create a FragmentComponent in Fragment#onCreate() (or even Fragment#onAttach()) to avoid this dependency on the activity to perform injection?

Assignee
Assign to
Time tracking