Q:

Android studio - new Activity with Fragment (XML files explanation)

I want to create a new Activity in Android Studio with MainActivity as a parent.  Although, when I create a blank activity (ex.  NewActivity) with a fragment added I get the two expected classes
(NewActivity and NewActivityFragment) but when I check the layout resources, I can't understand why there are 3 XML files auto-generated and what's their meaning?  

What is the exact meaning of each XML-file generated ?  The 3 XML files are the following : activity_new.xml, fragment_new.xml and content_new.xml

For example , if i want to add a TextView in the second activity, which XML file shall i modify? 

A:

When you create a New activity with a Fragment using the wizard in Android Studio, it will generate two src files :

NewActivity.java
NewActivityFragment.java

and three res files:

activity_new.xml 
content_new.xml
fragment_new.xml

The details goes as below:

The activity class NewActivity.java inflates the layout activity_new.xml in onCreate() method as below. 
setContentView(R.layout.activity_new);
This layout is a CoordinatorLayout and contains the Appbarlayout, FAB and the container for your main comonents. 
activity_new.xml includes another layout using include tag. 

content_new.xml is a fragment xml file and contains the attributes  to define its layouts. 
observer that content_new.xml has an attribute as below
tools:layout="@layout/fragment_new"
fragment_new.xml is the layout which gets inflated in NewActivityFragment onCreateView() method. 
inflater.inflate(R.layout.fragment_new, container, false);

fragment_new.xml is the layout file that is the place where you go for adding the components to be shown in the fragment.  So as per your requirement of adding a TextView in the fragment you need to add it in fragment_new.xml.