What the code should do: in the first fragment I have several EditText boxes, so people can fill in there name. In the second fragment I want the names to display in a TextView box. I thought using Shared Preferences was a good thing (correct me if I'm wrong).
In my first fragment I have this code:
public static String filename = "player1";
SharedPreferences someData;
[...]
someData = getActivity().getSharedPreferences(filename, 0);
String player1 = etPlayer1.getText().toString();
SharedPreferences.Editor editor = someData.edit();
editor.putString(player1, "player1");
editor.commit();
In my second fragment:
public static String filename = "player1";
SharedPreferences someData;
[...]
points1 = (TextView) getView().findViewById(R.id.tvPoints1);
someData = getActivity().getPreferences(0);
String dataReturned = someData.getString("player1", "Player 1");
points1.setText(dataReturned);