title: How to clear the string in the editText when clicking on it
body: <p>I really wish that you can help me. I my application in Android to clear or erase the the default string assigned to the editText object on the main Activity when clicking on it, only if the value is equal to this text "Enter a message here", which I assigned it in the R.java file as "R.string.editTextOnStart". Here's the code:</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity {
  
      private String text;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          final TextView textView = (TextView) findViewById(R.id.textView);
          final EditText editText = (EditText) findViewById(R.id.editText);
  
          editText.setText(R.string.editTextOnStart);
  
          textView.setText(R.string.textViewString);
  
          //if(editText.getText().toString().equals(String.valueOf(R.string.editTextOnStart))) {
  
              editText.setOnClickListener(new OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      text = editText.getText().toString();
  
                      if(text.equals(R.string.editTextOnStart)) {
                          editText.getText().clear();
                      }
                  }
              });
          //}
          Button button = (Button) findViewById(R.id.button);
          button.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View view) {
                  textView.setText(editText.getText().toString());
              }
          });
      }
  }
  </code></pre>