0

I would like to write app with some activities in ViewPager, so I'm writing smth like this:

calendarView = inflater.inflate(R.layout.calendar, null);
calendarView.setTag(getString("tag"));

Initing of a single view is quite a lot code. In fact I have 3 views, so initing of all of them looks like terrible. I'm just curious are there any other (correct) way of dealing with ViewPager?

Gorets
  • 2,434
  • 5
  • 27
  • 45

1 Answers1

1

I'm not very sure if I got what you want, but a good way of modularization is using Fragments. Pack-up your views + functionality in a Fragment and return each Fragment accordingly on getItem(FragmentPagerAdapter method). There is a source code on Android Training here http://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging

Alesqui
  • 6,417
  • 5
  • 39
  • 43