Create new activity android studio

To create a new activity in Android Studio, follow these steps:

  1. Open your project in Android Studio.
  2. In the Project panel, right-click on the app module (usually named "app") and select "New" > "Activity" > "Empty Activity".
  3. In the "Create Activity" dialog, select the following options:
    • Activity type: Empty Activity
    • Language: Java or Kotlin (depending on your preference)
    • Name: Enter a name for your activity (e.g., "MainActivity")
    • Package name: Leave this field blank (it will be automatically generated)
    • Save location: Choose a location to save your activity (e.g., "app/src/main/java")
  4. Click "Finish" to create the new activity.

Android Studio will create a new Java or Kotlin file for your activity, along with a corresponding XML layout file. The activity will be added to your project's manifest file (AndroidManifest.xml).

Here's a breakdown of the files that will be created:

You can now modify the code and layout files to customize your activity as needed.

Note: If you want to create a new activity with a specific template (e.g., a list activity or a fragment activity), you can select the corresponding option in the "Create Activity" dialog.