Fragment

Tutorial

Android: Add Tabs using TabLayout

In this tutorial we will see how to add tabs to a project by using TabLayout together with ViewPager, and some other new views from the design library :) Before starting I will make summary to present the main idea of creating the tabs. xml in the xml file, because we use TabLayout together with […]

, , , , , , , , , , , , ,
Solutions

Android onActivityResult not called from fragment

Today I had an issue with onActivityResult() method which was not called inside a fragment. My first impulse was to move the method inside the activity that hosts the fragment, and that’s what I actually did. So, I ran my app in debug mode and when I saw that the breakpoint stopped in the onActivityResult method from

, ,
Snippets

Clear Fragment back stack

To clear the Fragments back stack of a FragmentManager, you could iterate through all back stack items and call popBackStack() but there is also a more elegant solution. Please see below: // in my case I get the support fragment manager, it should work with the native one too FragmentManager fragmentManager = getSupportFragmentManager(); // this

, ,
Scroll to Top