There is the way to change visibility of View, but how can I change programmatically visibility of layout defined in XML? How to get layout object?
Use this Layout in your xml file
Define your layout in .class file
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.contacts_type);
Now if you want to display this layout just write
linearLayout.setVisibility(View.VISIBLE);
and if you want to hide layout just write
linearLayout.setVisibility(View.INVISIBLE);