Note that there are some explanatory texts on larger screens.

plurals
  1. POsetVisibilty() wont work first time
    text
    copied!<p>I have a layout called a controller in it i have a couple buttons and such the problem is in my onTouch function i want to show it on one click and hide it on another. Now this works after 2 touches. The first touch is supposed to show the controller while the next is supposed to make it disappear. The first and second touches do nothing but on the third touch it works. Here are the related functions for this</p> <pre><code>public boolean onTouchEvent(MotionEvent event) { int eventx = event.getAction(); switch(eventx) { case MotionEvent.ACTION_DOWN: if(isLifted) { if(!isVisible) { Log.i("onTouch", "called showPuse menu"); isVisible = true; isPaused = true; showPauseMenu(); } else if(isVisible) { hidePauseMenu(); isVisible= false; } isLifted = false; } break; case MotionEvent.ACTION_UP: if(!isLifted) { isLifted = true; //Log.i("onTouchEvent", "Lifted"); } } return false; } /*************************************************** * Shows All Views needed to be shown * Also pauses video and audio * * *************************************************/ private void showPauseMenu() { Log.i("showPauseMenu", "called"); playButton.setVisibility(View.VISIBLE); Log.i("showPauseMenu", "plaButton visible"); bottomButtons.setVisibility(View.VISIBLE); Log.i("showPauseMenu", "bottom Menu showed"); playButton.invalidate(); bottomButtons.invalidate(); pauseMedia(); } /************************************************ * Hides Views that are part of Pause Menu * Also starts video and audio back again */ private void hidePauseMenu() { playButton.setVisibility(View.GONE); bottomButtons.setVisibility(View.GONE); playMedia(); } </code></pre> <p>Can anyone say what the problem might be? I've been looking at this code for a couple of days now and cant see what it might be.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload