[FIXED] Add a fragment without xml file in Android studio chipmunk


I want to add a fragment to a project I downloaded without the XML file as the XML file I’m gonna use is already provided, except that in previous versions of android studio you could uncheck the create layout file checkbox
in the latest version, it doesn’t give you this option and if I create a layout file and then delete it, it gives me an error, how to fix this, please?


You could create a simple class that extends from Fragment, using your existing layout file to it:

public class YourFragment extends Fragment {
    public YourFragment() {

Answered By – Gaya Touak

Answer Checked By – Cary Denson (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published