code: @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          mOutput = (TextView)findViewById(R.id.output);
          mAutofitOutput = (TextView)findViewById(R.id.output_autofit);
  
          ((EditText)findViewById(R.id.input)).addTextChangedListener(new TextWatcher() {
              @Override
              public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                  // do nothing
              }
  
              @Override
              public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                  mOutput.setText(charSequence);
                  mAutofitOutput.setText(charSequence);
              }
  
              @Override
              public void afterTextChanged(Editable editable) {
                  // do nothing
              }
          });
      }
docs: Called when the activity is first created.