Translations:Android Training/Starting Another Activity/14/en: Unterschied zwischen den Versionen

Aus Android Wiki
(Neue Version von externer Quelle importiert)
 
(kein Unterschied)

Aktuelle Version vom 20. Dezember 2015, 21:22 Uhr

Nachricht im Original (Android Training/Starting Another Activity)
=== Create a new activity using Android Studio ===
Android Studio includes a stub for the <code>onCreate()</code> method when you create a new activity. The ''New Android Activity'' window appears.
# In Android Studio, in the <code>java</code> directory, 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 <code>DisplayMessageActivity.java</code> file. The class already includes an implementation of the required <code>onCreate()</code> 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.

Create a new activity using Android Studio[Quelltext bearbeiten]

Android Studio includes a stub for the onCreate() method when you create a new activity. The New Android Activity window appears.

  1. In Android Studio, in the java directory, select the package, com.mycompany.myfirstapp, right-click, and select New > Activity > Blank Activity.
  2. 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.
  3. Open the DisplayMessageActivity.java file. 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.