According to my requirement in android, if the user presses only "space" and clicks "post" button a toast should be displayed. So i have the code as below, but the toast doesnt get displayed. please can anybody tell why it is not displaying ?
mEditText.addTextChangedListener(mTextEditorWatcher);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String result =mEditText.getText().toString();
if(result.contains ("\\s"))
Toast.makeText(getApplicationContext(), "Space ", Toast.LENGTH_LONG).show();
}
});
}