I have a scroll view inside which there is a fragment and when i click on a button I want to switch fragment to another one. I tried Fragment Transaction but I am getting this error
java.lang.IllegalStateException: ScrollView can host only one direct child
Code :
Search search = new Search();
android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.scrollView,search).commit();