even though I create a Blank Fragment with attached xml layout. my Fragment java dont connet with fragment layout

Adrita Rahman :

Here is the java code with error

public class fragemnt extends Fragment {


public fragemnt() {
    // Required empty public constructor
}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.fragment_fragemnt, container, false);
}

}

here my javaFragment cannot find the Fragement_fragment layout eventhough the xml file shows in the layout direcotry

heres my Xml file

 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".FirstSemester.fragemnt">

    <!-- TODO: Update blank fragment layout -->
    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@string/hello_blank_fragment" />

</FrameLayout>
anis marzouk :

try to clean, the click on build. if it did not work try to invalidate cache and restart

enter image description here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=374217&siteId=1