vpBanner = (ViewPager) findViewById(R.id.vpBanner); This assignment means to find the control with the id vpBanner in the current activity layout. This control does not exist in your activity_main.xml. You should load the fragment_main.xml layout first, fragmentView = getLayoutInflater().inflate(R.layout.more_view,null); then vpBanner = (ViewPager) fragmentView.findViewById(R.id.vpBanner);
vpBanner is initialized in Fragment and uses rootView to findView
You can put this initView and initDot into fragment.
vpBanner = (ViewPager) findViewById(R.id.vpBanner); This assignment means to find the control with the id vpBanner in the current activity layout. This control does not exist in your activity_main.xml. You should load the fragment_main.xml layout first,
fragmentView = getLayoutInflater().inflate(R.layout.more_view,null); then
vpBanner = (ViewPager) fragmentView.findViewById(R.id.vpBanner);