@Override
    public void onClick(View view) {
        // Get the text from the EditText view.
        final String text = mEditText.getText().toString();

        final int changeTextBtId = R.id.changeTextBt;
        final int activityChangeTextBtnId = R.id.activityChangeTextBtn;

        if (view.getId() == changeTextBtId) {
          // First button's interaction: set a text in a text view.
          mTextView.setText(text);
        } else if (view.getId() == activityChangeTextBtnId) {
          // Second button's interaction: start an activity and send a message to it.
          Intent intent = ShowTextActivity.newStartIntent(this, text);
          startActivity(intent);
        }
    }
An {@link Activity} that gets a text string from the user and displays it back when the user
clicks on one of the two buttons. The first one shows it in the same activity and the second
one opens another activity and displays the message.
ui/uiautomator/BasicSample/app/src/main/java/com/example/android/testing/uiautomator/BasicSample/MainActivity.java