ViewStub raises error while inflating more than one layouts conditionally
In my app, I am having a spinner, and a ViewStub , depending upon the user item selection from spinner, I have to inflate different layouts and show the inflated layout below the spinner. When my app starts, ViewStub successfully inflates a layout on first time selection of any item from spinner. When I tries to select a new item from spinner, it raises Exception below java.lang.IllegalStateException: ViewStub must have a non-null ViewGroup viewParent My code so far is @Override public void onItemSelected(AdapterView<?> pParent, View pView, int pPosition, long pId) { if(pPosition == 1){ m