Translations:Android Training/Starting Another Activity/14/en
Create a new activity using Android Studio[edit source]
Android Studio includes a stub for the
onCreate() method when you create a new activity. The New Android Activity window appears.
- In Android Studio, in the
javadirectory, select the package, com.mycompany.myfirstapp, right-click, and select New > Activity > Blank Activity.
- In the Choose options window, fill in the activity details:
- Activity Name: DisplayMessageActivity
- Layout Name: activity_display_message
- Title: My Message
- Hierarchical Parent: com.mycompany.myfirstapp.MyActivity
- Package name: com.mycompany.myfirstapp Click Finish.
- Open the
DisplayMessageActivity.javafile. The class already includes an implementation of the required
onCreate()method. You update the implementation of this method later.
If you're developing with Android Studio, you can run the app now, but not much happens. Clicking the Send button starts the second activity, but it uses a default "Hello world" layout provided by the template. You'll soon update the activity to instead display a custom text view.