public void onResume() { super.onResume(); Button button = (Button) findViewById(R.id.ButtonNewComment); // Button is only present if we're authenticated if (!isAuthenticated()) { button.setVisibility(View.GONE); } else { button.setVisibility(View.VISIBLE); } }