Android: Changing layout in same activity
<p>In my application's main layout I have a button of Search task. Now when user clicks that button I want to change the layout xml file to search_layout.xml. 
I don't want to create a new activity for Search task and want to use my activity_main.java class for its coding. So how do I inflate search_layout from existing activity_main.xml .</p>

<p>My activity_main layout is Coordinating layout with Collapsing toolbar and Recycler view.</p>

<p>In my search_layout.xml I have a Simple relative layout. </p>

<p>So how to deal with this ? <strong>I searched for this but everywhere I get how to inflate view adding to an existing view. But in my case I want to totally change view.</strong></p>

<p>Thanks</p>