Dial Button Visibility

I added a button in the layout and got its link in action:

Button button1=(Button)findViewById(R.id.button1);
button1.setVisiblity(View.Visible);

The program crashes with this code. How to set visibility?

+5
source share
4 answers

What mistake? it should be View.VISIBLE(in upper case).

If you have an exception with a null pointer at this point, perhaps because it does not find the view in your layout.

+15
source

Steve,

You tried to View.VISIBLEmake sure that it VISIBLEis in all the caps.

+3
source

View.Visible UpperCase, :

button1.setVisibility(View.VISIBLE);

, , Acitivity.runOnUIThread(new Runnable());

+3
source

If you use C #, you can use

 button1.Visibility = ViewStates.Visible;

I had the same problem initially.

0
source

All Articles