Sunday, May 25, 2014

Get ViewPager's current fragment

I often want to implement dialog callback inside fragment class rather than the activity. So in the attach() method, I'll need find current fragment from activity.

Here is the way to do that:

public Fragment getCurrentFragment() {
        return getSupportFragmentManager().findFragmentByTag("android:switcher:" +
                R.id.vp_edit_reward_entries + ":" + mViewPager.getCurrentItem());
    }

But one culprit is that the ViewPager adapter has to be FragmentPagerAdapter not the FragmentStatePagerAdapter.

Monday, January 20, 2014

KidzTube - A kids friendly YouTube player App

My son started to use YouTube at age of 2. I have to say YouTube taught my son letters, numbers and more. One thing I realized at the beginning, I can't just be an irresponsible father and leave everything to YouTube. I have to guide my son to use YouTube to let him enjoy and learn. First and most important thing is the content. At the age of two I don't have to worry much about sexual and violent contents, at least he won't intentionally searching those content behind of me. But I have to find
Google+