Android, from Coursera course beginning 25 Sept 2017

From MyWiki
Revision as of 13:16, 28 September 2017 by George2 (Talk | contribs)

Jump to: navigation, search

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
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())