Created
May 17, 2016 11:55
-
-
Save atultiwari/abe89be3a97705c3219d4c428886798a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Fragment getVisibleFragment(){ | |
FragmentManager fragmentManager = MainActivity.this.getSupportFragmentManager(); | |
List<Fragment> fragments = fragmentManager.getFragments(); | |
if(fragments != null){ | |
for(Fragment fragment : fragments){ | |
if(fragment != null && fragment.isVisible()) | |
return fragment; | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment