How to get variables from separate fragments using the same class

view story

http://stackoverflow.com – In my Android app, I have an activity with 4 fragments. All the fragments have the same exact fields, so they are all inflated from the same xml file and have the same java class. However, I need to get the data stored in each of them because the user will be entering things in each one. So how would I be able to get the data if they all have the same class? activity_success.xml <Button android:id="@+id/continue_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cont" /> <Button android:id="@+id/export_b (HowTos)