Skip to content

Commit 80ff3bd

Browse files
committed
Create README.md
1 parent d1ef24f commit 80ff3bd

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# First Tutorial
2+
3+
![alt tag](https://www-s.acm.illinois.edu/sigmobile/sig_mobile-01.png)
4+
5+
The first meeting tutorial, building your first Android app!
6+
7+
8+
#Step 1
9+
10+
Installing Android Studio
11+
12+
Go to http://developer.android.com/sdk/index.html and download Android Studio. Install it. Make sure you have the JDK
13+
installed on your computer: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
14+
15+
#Step 2
16+
Creating a new Project
17+
18+
Open up Android Studio and Start a new Project...
19+
20+
![alt tag](http://i.imgur.com/zO4NlHy.png)
21+
22+
Name your application (MyFirstApp, etc.), and set the Minimum SDK
23+
24+
![alt tag](http://i.imgur.com/XEVXcXD.png)
25+
![alt tag](http://i.imgur.com/uJVgYla.png)
26+
27+
Start with a Blank Activity, name it MainActivity.
28+
29+
![alt tag](http://i.imgur.com/PNEnZO6.png)
30+
![alt tag](http://i.imgur.com/UUZ3aaV.png)
31+
32+
Gradle should invocate your project, and take you into the activity!
33+
34+
35+
36+
#Step 2
37+
Adding Content
38+
39+
40+
Go to your activity_main.xml. the XML specs the appearance of the file, while the Java activities add functionality.
41+
Drag a Button (under Widgets) onto the screen.
42+
43+
![alt tag](http://i.imgur.com/wuP63bP.jpg)
44+
45+
If you go to the Text tab in the XML, you'll be able to see the code generated by Android Studio for the Button.
46+
47+
![alt tag](http://i.imgur.com/uuZxRpy.png)
48+
49+
Run your code if you wish, and you'll see the new Button next to your Hello World!
50+
51+
Now that we have a button, let's make it do something.
52+
53+
54+
#Step 3
55+
Adding functionality to your content
56+
57+
58+
Let's define a method in our MainActivity called buttonOnClick, which will execute an action when the Button is clicked.
59+
60+
![alt tag](http://i.imgur.com/R0H21b6.png)
61+
62+
In this method, lets make a TextView variable that will change the Text displayed when the button is clicked.
63+
You can do this by first linking a TextView variable to the one being displayed, and then updating it.
64+
It will update when the method is called.
65+
66+
![alt tag](http://i.imgur.com/OCfc9qI.png)
67+
68+
Let's add a couple things to our XML to support the actions:
69+
If it isn't already there, add the line:
70+
```
71+
android:id="@+id/textView"
72+
```
73+
inside your TextView so that the buttonOnClick function can access and change the View.
74+
Additionally, add the following line:
75+
```
76+
android:onClick="buttonOnClick"
77+
```
78+
to your Button. This has your program execute the specified method when the button is clicked.
79+
80+
![alt tag](http://i.imgur.com/SIEydtd.png)
81+
82+
83+
#Step 4
84+
85+
Run your app!
86+
![alt tag](http://i.imgur.com/QdkZgGe.png)
87+
88+
Click the button!
89+
90+
![alt tag](http://i.imgur.com/XqBU8t9.png)
91+
92+
93+
If you enjoyed this tutorial and want to learn more, check out the rest of the tutorials on this Github and come to SiGMobile
94+
meetings! We'll see you there!
95+
96+

0 commit comments

Comments
 (0)