I've started using a ViewPager on my app but I am not find the migration from the current layout easy. I'm looking for a better way than to rewrite most of my Activity's code...
Currently I have most of initialization code on the Activity's onCreate(), for instance, stuff like findViewbyId() for EditTexts and Spinners. Those references are saved as private instance variables so I can easily access them on any method, which I actually need to do. I'm having problem migrating that code. The way I see it, I need to move most of my Activity's code to the ViewPager adapter and setup a couple of public methods (in the adapter) to be called from the Activity, whenever needed. The problem is on the PagerAdapter instantiateItem() method. That's where I initialize my views, the pages, inflating each corresponding layout. Which means that I can't simply do viewPager.findViewById() on the Activity's onCreate() method because the layouts have not been inflated yet and it would return null. What are my options to solve this problem? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

