Difference between revisions of "First steps"

From MyWiki
Jump to: navigation, search
(Created page with "Simple first program<br> 1. choose empty activity<br> 2. we will edit activity_main.xml and MainActivity.java<br> 3. use api level 16<br> 4. Get rid of "hello world" 5. Drag...")
 
Line 12: Line 12:
 
                           }<br>
 
                           }<br>
 
in oncreate<br>
 
in oncreate<br>
buttonBlue = (Button) findViewById(R.id.button_blueinvisible)<br>
+
button buttonblue;<br>
 +
buttonBlue = (Button) findViewById(R.id.button_blueinvisible);<br>
 
define button in main activity<br>
 
define button in main activity<br>
 
if ( v.equlas(buttonblue))  then do the stuff<br>
 
if ( v.equlas(buttonblue))  then do the stuff<br>
 
Toast.makeText(getApplicationcontext(), "asdfadsfa", Toast.LENGTH_SHORT.show())
 
Toast.makeText(getApplicationcontext(), "asdfadsfa", Toast.LENGTH_SHORT.show())

Revision as of 15:51, 4 October 2017

Simple first program
1. choose empty activity
2. we will edit activity_main.xml and MainActivity.java
3. use api level 16
4. Get rid of "hello world" 5. Drag button
6 width = match parent, change background colour
7 changethe id of the button and also the text

8 onclick property, speccify the name of method
9. public void toDo(View v){

                          }

in oncreate
button buttonblue;
buttonBlue = (Button) findViewById(R.id.button_blueinvisible);
define button in main activity
if ( v.equlas(buttonblue)) then do the stuff
Toast.makeText(getApplicationcontext(), "asdfadsfa", Toast.LENGTH_SHORT.show())