O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Coding the Add Button

Coding the Add button is just reusing code that you used before (Listing 6.17).

Listing 6.17 initAddContactButton() Method

private void initAddContactButton() {    Button newContact = (Button) findViewById(R.id.buttonAdd);    newContact.setOnClickListener(new OnClickListener() {        public void onClick(View v) {            Intent intent = new Intent(ContactListActivity.this, ContactActivity.class);            startActivity(intent);        }    });}

Remember to call the initAddContactButton() method in the onCreate method.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required