Download presentation
Presentation is loading. Please wait.
1
Android Studio Hello World
2
Start/All Program/Android Studio/Android Studio
3
I do not have a previous version … OK
4
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.
5
Next. Maybe only the first user (me for the lab computers) sees this.
6
Next (again)
7
Finish
8
Finish (again)
9
Start a new Android Studio project
10
Name the application and click Next
11
Select a minimum SDK. Next.
12
Next
13
Choose an empty activity. Next
14
Finish
15
Close tip of the day
16
Click the Run App button (green arrow)
17
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
18
Next
19
Select a system image
20
Agree to license. Next.
21
Finish
22
Select image. Next.
23
Finish
24
OK
25
Install and continue
26
Finish
27
After closing the emulator and running again
28
Go to activity_main.xml (see res/layout)
29
Right click on “Hello world” TextView and select Cut.
30
Click ON the Auto Connect (U) button
31
Drag a button from the palette to the layout
32
Change the button’s id and text
33
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
34
Result in Text View. Constraints are important in the ConstraintLayout
35
Drag a TextView onto the Layout
36
Change the TextView’s id and text
37
Apply the constraints – this time connect the top of the TextView to the bottom of the Button
38
Result
39
Additional property it asked for to eliminate red
40
Return to MainActivity – begin to instantiate a button object
41
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
42
Start adding the button’s setOnClickListener method
43
Add required onClick method
44
Instantiate TextView object and use its setText method
45
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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.