Difference between revisions of "First steps"

From MyWiki
Jump to: navigation, search
Line 16: Line 16:
 
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();<br>

Revision as of 16:35, 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();