title: how to disable TextWatcher on setting data to edittext
body: <p>I am using <code>TextWatcher</code> on <code>EditText</code> .when I input something in <code>edittext</code> it works perfectly but when I set data into <code>edittext</code> from database getting <code>NullPointerException</code>. I used <code>onTouchListener</code> to on this <code>Edittext</code>. my question is.
  could I check the condition that <code>TextWatcher</code> works only after touch event is true.</p>
  
  <pre><code>EditText det=(EditText) findViewById(R.id.det);
      det.setOnTouchListener(new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              // TODO Auto-generated method stub
              System.out.println(v.getId());
              d_id=v.getId();
              if (event.getAction() == MotionEvent.ACTION_UP) {
                  getPopUp(det);
              }
              return false;
          }
      });
  </code></pre>
  
  <p>when I call setText on det it goes to <code>TextWatcher</code></p>
  
  <pre><code>det.setText(ft.get_det().toString());
  </code></pre>
  
  <p>TextWatcher</p>
  
  <pre><code>                    @Override
              public void afterTextChanged(Editable string) {
                  try {
  
                      int rp=0;
                      det=(EditText)findViewById(d_id);
                      s_id=d_id-4;
                      sev=(EditText)findViewById(s_id);
                      o_id=d_id-2;
                      occ=(EditText)findViewById(o_id);
                      rp=d_id+1;
                      rpn=(TextView)findViewById(rp);
                      if (sev.getText().length() &gt; 0
                              || occ.getText().length() &gt; 0
                              || sev.getText().length() == 0) {
                          if (string.length() &gt; 0) {
                              int s, o, d, r;
                              System.out.println(sev.getId());
                              System.out.println(det.getId());
                              s = Integer.parseInt(sev.getText().toString());
                              o = Integer.parseInt(occ.getText().toString());
                              d = Integer.parseInt(det.getText().toString());
                              r = s * o * d;
                              String m = r + "";
                              rpn.setText(m);                         
                          } else {
                              // det.setText("");
                              // rpn.setText("");
                               System.out.println("In else");
                          //  makeToast();
                          }
                      }
  
                  } catch (Exception e) {
                      det.setText("");
                      rpn.setText("");
                      System.out.println("IN Exception");
                      makeToast();
                  }
              }
          };
  </code></pre>