You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into issues attempting to do the following:
classMyFragmentextendsListFragmentwithTraitContext[Context] {
overridedefbasis= getActivity
lazyvaladapter=newMyAdapteroverridedefonCreate(savedInstanceState: Bundle) = {
super.onCreate(savedInstanceState)
setListAdapter(adapter)
}
//Actual data is given to the adapter later, though the data itself is irrelevant
}
classMyAdapter(implicitcontext: Context) extendsBaseAdapter {
deflayoutInflater=LayoutInflater.from(context)
overridedefgetView(index: Int, convertView: View, parent: ViewGroup) = {
if (convertView ==null) {
layoutInflater.inflate(...) // Error occurs here
}
}
}
The issue stems from the fact that getActivity returns null at the point where implicit val ctx = basis is evaluated. This could be fixed if ctx were changed to a def or a lazy val.
The text was updated successfully, but these errors were encountered:
I've run into issues attempting to do the following:
The issue stems from the fact that
getActivity
returns null at the point whereimplicit val ctx = basis
is evaluated. This could be fixed ifctx
were changed to adef
or alazy val
.The text was updated successfully, but these errors were encountered: