title: how to get length of the words typed in edittext on textview in android?
body: <p>How can I show the length of words typed into a textview?</p>
  
  <p>This is the code, but my app stops responding if I type anything:</p>
  
  <pre><code>ed1=(EditText) findViewById(R.id.editText2);
  
  ed1.addTextChangedListener(new TextWatcher() {
  
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
              // TODO Auto-generated method stub
          }
  
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void afterTextChanged(Editable s) {
              // TODO Auto-generated method stub
              TextView t1=(TextView) findViewById(R.id.textView1);
              t1.setText(ed1.getText().toString().length());
          }
      });
  </code></pre>
  
  <p>Code is written in onCreate().</p>