Articles → Android → Create An Empty Activity In Android Studio
Create An Empty Activity In Android Studio
Create An Empty Activity
- Right click on your package and click on ‘New’ → ‘Activity’ → ‘Empty Activity’.Click to Enlarge
- A popup window will appear to enter the activity name. Enter the activity name and click on ‘Finish’ button.Click to Enlarge
Explaining Files Created In Empty Activity
- Activity_main2.xml – This is the file where you can create UI elements. For now this file only contains root tag and namespaces.
- Main2activity.java – In this file you can write the validations, business logic and database layer.
- The class is inherited from AppCompatActivity class. This is the base class of all activities.
- onCreate method is overridden.
- setContentView specifies the associated XML file.