I am beginner, trying to learn while doing, and the Google results are too complicated for me at this point.
I have an Activity and successfully managed to make a fragment open and close via button press.
public void pressedButton(View v) {
FragmentActivity fragmentActivity = new FragmentActivity();
FragmentManager fragmentManager = getSupportFragmentManager();
android.support.v4.app.FragmentTransaction ft = fragmentManager.beginTransaction();
ft.add(R.id.frame_which_takes_the_fragment, FragmentActivity, "FRAGMENT_TAG");
ft.commit();
As the fragment class stipulates, i implemented its "OnFragmentInteractionListener" interface in the Activity and overrode the onFragmentInteraction method.
@Override
public void onFragmentInteraction(Uri uri) {
}
And now I don't know how to progress. How do i send a variable from the activity to the fragment (for example to update a number in the user interface) and how do I send information back?
Please, keep in mind that I am a bloody beginner and try to keep it as basic and simple as possible.
Thanks in advance.