Lets assume i have three fragments
inside viewPager
adapter.
Does it create view (on create view called) every time i scroll to that fragment
OR
is it called only in initialization in main activity when we try to set adapter?
If it is the second, then heavy work will be done at the beginning. If it is first, then i have to save fragments states and must not call its init methods all the time.
Thanks in advance.
List<Fragment> l = new ArrayList<>();
l.add(Fragment.instantiate(this, DashBoard.class.getName()));
l.add(Fragment.instantiate(this,Expenses.class.getName()));
l.add(Fragment.instantiate(this,Gross.class.getName()));
SliderAdapter sa = new SliderAdapter(getSupportFragmentManager(),l);
vp = (ViewPager) findViewById(R.id.viewPager);
vp.setAdapter(sa);