Java we have updated the code by specifying sufficient

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: in.putExtra("Friend Name", "Hello " +name); } 12. We need to add two different cases for the two different buttons. For both buttons we get the case number and update the code within switch block in the following way, switch(v.getId()){ COMP 4521 (Spring 2014) Week 3 3 case R.id.button1: // add the name to the intent in.putExtra("Friend Name", "Hello " +name); break; case R.id.button2: // add the name to the intent in.putExtra("Friend Name", "Goodbye " +name); break; } 13. We find that when we call MainActivity.java, we display the friend's name using setText() method by appending the "Hello" in the message format as ("Hello " +friend), bu...
View Full Document

Ask a homework question - tutors are online