Android - getSupportFragmentManager returns null -
i trying specific instance of fragment using it's tag, using viewpager, makes things difficult. used: public fragment getfragmentbyposition(int pos) { string tag = "android:switcher:" + r.id.pager + ":" + pos; fragmentmanager fragmentmanager = this.getsupportfragmentmanager(); fragment fragment = fragmentmanager.findfragmentbytag(tag); return fragment; } to find fragment, getsupportfragmentmanager returning null. the above method in activity, outside of viewpager adapter class, , lost here. highly appreciated, thanks! you can use smartviewpager here https://gist.github.com/jacek-marchwicki/d6320ba9a910c514424d extend view pager class , fragment using getactivefragment method. can change implementation of method fragment tag name. public fragment getactivefragment(string name) { final fragment fragmentbytag = fragmentmanager.findfragmentbytag(name); if (fragmentbytag == null) { final bytearrayoutputstream out...