Created
July 15, 2024 03:49
-
-
Save anantyan/f280c0a1336149b2ecef8e997ea69982 to your computer and use it in GitHub Desktop.
How do I create a passing argument between fragments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IF - Fragment B position | |
private static final String PASSING_DATA = "PASSING_DATA"; | |
public static <Fragment> newInstance(<TypeData> data) { | |
<Fragment> fragment = new <Fragment>(); | |
Bundle args = new Bundle(); | |
args.putString(PASSING_DATA, data); | |
fragment.setArguments(args); | |
return fragment; | |
} | |
private <TypeData> getData() { | |
Bundle args = getArguments(); | |
return args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment