It does give me warning but I\'ve never used fragments so I\'m not sure how to fix it. I get the error on the third line of the code where I\'m trying to find the toolbar.
You're calling getView()
inside onCreateView()
. By that time, the view
is not set, since you're right then constructing it.
The call to getView()
will return non-null after onCreateView()
and before onDestroyView()
.
Instead, just call view.findViewById
in the View
you have just inflated, which I assume is what you want.
LinearLayout mapsT = view.findViewById(R.id.locationT);