public void setContentView ( View view ) { ensureContent ( ) ; if ( view == null ) { throw new IllegalArgumentException ( "Content view can't be null" ) ; } if ( mContentContainer instanceof ViewGroup ) { ViewGroup contentContainer = ( ViewGroup ) mContentContainer ; if ( mContentView == null ) { contentContainer . addView ( view ) ; } else { int index = contentContainer . indexOfChild ( mContentView ) ; // replace content view contentContainer . removeView ( mContentView ) ; contentContainer . addView ( view , index ) ; } mContentView = view ; } else { throw new IllegalStateException ( "Can't be used with a custom content view" ) ; } }
Set the content view to an explicit view . If the content view was installed earlier the content will be replaced with a new view .