title: Getting last typed word in a string variable in Android
body: <p>I need to get the typed words from <code>textbox</code> for further use. </p>
  
  <p>So i am using the <code>TextWatcher</code> and at <code>onTextChanged</code> event i am getting the <code>edittext</code> box Content. It gives the full content of the text box. </p>
  
  <p>But i need the typed word not the full content of the <code>textbox</code>. 
  I need the last typed word in a string variable once the user press the <code>spacebar</code>. </p>
  
  <p>My code is here and temptype holding the full content.</p>
  
  <pre><code>tt = new TextWatcher() {
              public void afterTextChanged(Editable s){
                   et.setSelection(s.length());
              }
              public void beforeTextChanged(CharSequence s,int start,int count, int after){} 
  
              public void onTextChanged(CharSequence s, int start, int before, int count) {
                  et.removeTextChangedListener(tt);
                  typed = typed + et.getText().toString();
                  String temptype;
                  temptype = et.getText().toString(); 
                  if (temptype == " "){
                      showToast("Word: "+typed);
                  }
                  et.addTextChangedListener(tt);
              }
          };
          et.addTextChangedListener(tt);
  </code></pre>