December 2013
Intermediate to advanced
464 pages
14h 46m
English
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.
Read now
Unlock full access