He studied the book "Android. Programming for professionals", 2nd edition.
There in all projects 2 SingleFragmentActivity files are SingleFragmentActivity :
public abstract class SingleFragmentActivity extends AppCompatActivity { protected abstract Fragment createFragment(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_container); if (fragment == null) { fragment = createFragment(); fm.beginTransaction() .add(R.id.fragment_container, fragment) .commit(); } } } activity_fragment:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent"/> How to set up AndroidStudio so that when creating a project there were exactly these files, is it possible to create your own template or other options?
In addition to these files, there must also be one file, the main MainActivity, which is created when creating a project according to the standard.
