In my xml, I have the following code:
<fragment android:name="somepackage.Fragments.ToolbarFragment" android:id="@+id/toolbar_fragment" android:layout_width="match_parent" android:layout_height="wrap_content"/>
and in my code I have:
private ToolbarFragment toolbarFragment; toolbarFragment = (ToolbarFragment) findViewById(R.id.toolbar_fragment);
I get an error: "cannot use android.view.View for somepackage.Fragments.ToolbarFragment"
why does the android see the fragment as a general type of representation, and not as the class of the fragment that I specified?
source share