android - Load Only First Tab's Fragment of viewpager -
i using tablayout viewpager , having 3 tabs. using fragmentpageradapter set tabs , it's fragments. i want load first tab's fragment when selected default , want load other tab's fragment in new activity. i have tried return null when getitem method in case of position 1 , 2 gives exception. how can this, can please me here. thanks lot in advanced. when use fragmentpageradapter typically extend , override couple of methods. 1 of them getitemcount() . make return 1 or 3 (or whatever) depending on hosting activity . example, pass hosting activity parameter , check activity class host of tabs in getitemcount() method. you add own method public void setitemcount(int count) change amount of tabs shown (and fragment s loaded). not sure if work.