second fragment to first fragment code example
Example: how to come from 2nd fragment to first fragment android
All you have to do is implement the correct type of listener, but the main point is shown. In one fragment activity, call a method and pass a variable to the main activity. From the main activity you can send it to your other fragment activity if you'd like