I have a fragment class which contains a method called "loadSongs" that loads all the songs from external storage and displays it in the recyclerview. I want to call this method from main activity. How can I do it?
Asked
Active
Viewed 79 times
0
-
Check out the correct answer on this question: https://stackoverflow.com/questions/22536565/call-activitys-methods-from-fragment – king_abu1918 Oct 01 '17 at 02:53
-
1Possible duplicate of [Calling a Fragment method from a parent Activity](https://stackoverflow.com/questions/10903077/calling-a-fragment-method-from-a-parent-activity) – Dima Kozhevin Oct 01 '17 at 03:18
-
Where can I find the id for the fragment? – Sebin Paul Oct 01 '17 at 04:05
-
@SebinPaul if you don't have id give fragment a tag and retrieve using that tag – KingKongCoder Oct 01 '17 at 04:40
-
Sorry for this noobish question, but how to retrieve the tag? I have given a tag. But when I try to retrieve it gives me an error. – Sebin Paul Oct 01 '17 at 06:31