Or you could use the newInstance method - create a method inside your Fragment class like:
public static TransactionDetailsFragment newInstance(String param) {
TransactionDetailsFragment frag = new TransactionDetailsFragment();
Bundle bund = new Bundle();
bund.putString("paramkey", param); // you use key to later grab the value
frag.setArguments(bund);
return frag;
}
So to create your fragment you do:
TransactionDetailsFragment.newInstance("PASSING VALUE");
(This is used instead of your new TransactionDetailsFragment()
)
Then for example in onCreate/onCreateView of the same fragment you get the value like this:
String value = getArguments().getString("paramkey");