Android Boot Camp Project Part 1 Walk Through

Version 3

    This is a walk through of part 1 of the Boot Camp project.  The code snippets are repeated here:

    1. After: “public class MainActivity extends ActionBarActivity {”


              private TextView textOutput;          

               private EditText textInput;


    2. After: “protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);”


              textOutput = (TextView)findViewById(;        

              textInput = (EditText)findViewById(;              


              textInput.setOnKeyListener(new EditText.OnKeyListener() {                           

                   public boolean onKey(View v, int keyCode, KeyEvent event) {         

                        if ((event.getAction() == KeyEvent.ACTION_DOWN)         

                        && (keyCode == KeyEvent.KEYCODE_ENTER))


                        return false; }     



    3. At the end of your application before the final “}”,

         Insert :  

              public void Button1Clicked (View v)     {        TransferInput();     }      


              public void TransferInput(){        String input;               input = textInput.getText().toString();        textOutput.setText(input);        textInput.setText("");         }