How to send data from fragment to activity [duplicate]
问题 This question already has answers here : Passing data between a fragment and its container activity (13 answers) Closed 2 years ago . In my application I have two fragments in an activity. In one of the fragments I have data, such as : String name = "Transporter"; I want send this name to container activity. How can I do it? Please help me. 回答1: The fragment will be attached to the activity which you launch from. Thus, you can create a callback method in your activity which can be called from