Deploy onTouchListener
// Catch touch events here @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { System.out.println("Touch Down X:" + event.getX() + " Y:" + event.getY()); } if (event.getAction() == MotionEvent.ACTION_UP) { System.out.println("Touch Up X:" + event.getX() + " Y:" + event.getY()); } return super.onTouchEvent(event); }
Then in this case you will want to refer to the button and set its visibility:
button1.setVisibility(View.VISIBLE); or View.INVISIBLE
source share