Android Studio Hello World
Start/All Program/Android Studio/Android Studio
I do not have a previous version … OK
Lack of permissions Android Studio likes to update often. You probably do not have the necessary permissions on the lab computers so avoid clicking on update.
Next. Maybe only the first user (me for the lab computers) sees this.
Next (again)
Finish
Finish (again)
Start a new Android Studio project
Name the application and click Next
Select a minimum SDK. Next.
Next
Choose an empty activity. Next
Finish
Close tip of the day
Click the Run App button (green arrow)
If there is a virtual device available choose it If there is a virtual device available choose it. If not, click on create New Virtual Device
Next
Select a system image
Agree to license. Next.
Finish
Select image. Next.
Finish
OK
Install and continue
Finish
After closing the emulator and running again
Go to activity_main.xml (see res/layout)
Right click on “Hello world” TextView and select Cut.
Click ON the Auto Connect (U) button
Drag a button from the palette to the layout
Change the button’s id and text
Drag from the little circle on top to the top of the container and from the circle of the right and left edge to the side of the container
Result in Text View. Constraints are important in the ConstraintLayout
Drag a TextView onto the Layout
Change the TextView’s id and text
Apply the constraints – this time connect the top of the TextView to the bottom of the Button
Result
Additional property it asked for to eliminate red
Return to MainActivity – begin to instantiate a button object
Put mouse over Button (which was red) and click Alt-Enter Put mouse over Button (which was red) and click Alt-Enter. Adds the import android.widget.Button
Start adding the button’s setOnClickListener method
Add required onClick method
Instantiate TextView object and use its setText method
Run Problem you may find: if you did not take care of the constraints, the TextView and Button may be on top of one another.