button.setOnTouchListener(new OnTouchListener() { public void onClick(View v) { Toast.makeText(MainActivity.this, \"YOUR TEXT\", 5000).show(); } }); <
button.setOnTouchListener(new OnTouchListener() { public void onClick(View v) { Toast.makeText(MainActivity.this, \"YOUR TEXT\", 5000).show(); } });
you are putting an ontouchlistener with an onclick listener thats your mistake.
button.setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { Toast.makeText(MainActivity.this, "YOUR TEXT", 5000).show(); return false; } });