[Solved] how to validate view visibility on button click listener

Use this it works….. create boolean variable as global within class but outside methods. boolean flag=true; and add this clicked method. @Override public void onClick(View v) { if (flag){ power.setVisibility(View.GONE); flag=false; } else { flag=true; power.setVisibility(View.VISIBLE);} } }); mute always visible , because you performing visibility with power that why the result coming same. enjoy … Read more