ViewPagerFragments args (System.out.println() and TextView act differently)
<p>So I have created a Fragements inside ViewPager and below is my part-code:
(System.out.println(mNum) not printing actual values but TextView is. For example when sliding fragments from left to right, in second fragment, it prints 1 but when sliding right to left it prints 2, although TextView display it properly in both cases. 
From Android.Developers <a href="http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html" rel="nofollow">http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html</a></p>

<pre><code>@Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            mNum = getArguments().getInt("num");
            viewPager=(ViewPager)getActivity().findViewById(R.id.pager);
        }

        /**
         * The Fragment's UI is just a simple text view showing its
         * instance number.
         */
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View v = inflater.inflate(R.layout.fragment_pager_list, container, false);
            View tv = v.findViewById(R.id.text);
            ((TextView)tv).setText("Fragment #" + mNum);
            System.out.println(mNum);
            return v;
        }
</code></pre>