Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work
<p>I want my datepicker and the button to be no visible in the begining. And when i press my magic button i want to setVisibility(View.Visible);</p>

<p>The problem here is when i set Visibility(View.GONE or INv...) Nothing change the component is still visible.</p>

<pre><code>final DatePicker dp2 = (DatePicker) findViewById(R.id.datePick2);
    final Button btn2 = (Button) findViewById(R.id.btnDate2);
    dp2.setVisibility(View.GONE);
    dp2.setVisibility(View.INVISIBLE);
    btn2.setVisibility(View.GONE);
    btn2.setVisibility(View.INVISIBLE);
    btn2.setOnClickListener(new View.OnClickListener() {

        public void onClick(View arg0) {
            // TODO Auto-generated method stub

            TextView txt2 = (TextView) findViewById(R.id.txt2);
            txt2.setText("You selected " + dp2.getDayOfMonth() + "/" + (dp2.getMonth() + 1) + "/" + dp2.getYear());
        }
    });
</code></pre>

<p>Have a good day , thank You..</p>
