Fragment not instantiatable
Fragment not instantiatable
From the Fragment documentation:
Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with setArguments(Bundle)
and later retrieved by the Fragment with getArguments()
.
Note that this is no longer true when you are using androidx.fragment.app.Fragment
; with the FragmentFactory
you can supply any arguments you want (as of version androidx version 1.1).
Issue id: ValidFragment
https://developer.android.com/reference/android/app/Fragment.html#Fragment()
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3 |
Plugin: | Android, 2022.3.1 Beta 2 |