You should try to Clear the project or try to restart Eclipse or any other editor that you use, because it is valid code and should work fine.
UPDATE:
In addition, you should check your Logcat, you get the output of Log.d("TEST", "TEST"); , because your Toast seems to be implemented incorrectly.
Toast.makeText(this, "TEST", Toast.LENGTH_SHORT).show(); // wrong Toast.makeText(Activity_name.this, "TEST", Toast.LENGTH_SHORT).show(); // correct
Using this in Toast inside the Listener means that you are referencing the listener, which really shouldn't be. You must refer to the Activity itself, so it is better to use Activity_name.this .
Lalit poptani
source share