How to save multiple user inputted data to a file in Android Studio
<p>I am having trouble trying to figure out how to save user inputted data into my app.  I'm attempting to create a mock basketball statistics app that will store stats per each day and then average out the different stats.  Before I can do any of the actual math, though, I cannot figure out how to save the data and load it.
This is the code that I have so far for both activities:</p>

<p><strong>Main Activity</strong></p>

<pre><code>package com.miahollins.basketballfinal;

import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Toast;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;

public class MainActivity extends AppCompatActivity {
    int gamesp, gamest,points,perfoul;
    Button btn;
    int year_x,month_x,day_x;
    static final int DIALOG_ID=0;
    EditText games, game2, game3, game4;


 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final EditText game1 = (EditText) findViewById(R.id.games);
        final EditText game2 = (EditText) findViewById(R.id.games2);
        final EditText game3 = (EditText) findViewById(R.id.games3);
        final EditText game4 = (EditText) findViewById(R.id.games4);

    Button results = (Button) findViewById(R.id.button);
    final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    results.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            gamesp = Integer.parseInt(game1.getText().toString());
            gamest = Integer.parseInt(game2.getText().toString());
            points = Integer.parseInt(game3.getText().toString());
            perfoul = Integer.parseInt(game4.getText().toString());
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putInt("key1", gamesp);
            editor.putInt("key2", gamest);
            editor.putInt("key3", points);
            editor.putInt("key4", perfoul);
            editor.commit();
            startActivity(new Intent(MainActivity.this, Status.class));


        }


    });
    final Calendar cal = Calendar.getInstance();
    year_x = cal.get(Calendar.YEAR);
    month_x = cal.get(Calendar.MONTH);
    day_x = cal.get(Calendar.DAY_OF_MONTH);

    showDialogOnButtonClick();
}

public void save(View view){
    String value = games.getText().toString();
    String file_name="stats";

    try {
        FileOutputStream fileOutputStream = openFileOutput(file_name,MODE_PRIVATE);
        fileOutputStream.write(value.getBytes());
        fileOutputStream.close();
        Toast.makeText(getApplicationContext(),"Message Saved",Toast.LENGTH_LONG).show();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }


}



public void showDialogOnButtonClick(){
    btn=(Button)findViewById(R.id.button2);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showDialog(DIALOG_ID);
        }
    });
}

@Override
protected Dialog onCreateDialog(int id){
    if (id==DIALOG_ID)
        return new DatePickerDialog(this,dPickerListener,year_x,month_x,day_x);
    return null;
}
private DatePickerDialog.OnDateSetListener dPickerListener= new DatePickerDialog.OnDateSetListener() {
    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
        year_x=year;
        month_x=monthOfYear+1;
        day_x=dayOfMonth;
        Toast.makeText(MainActivity.this,year_x+" / " + month_x+" / "+day_x,Toast.LENGTH_LONG).show();
    }
};
}
</code></pre>

<p><strong>Second Activity</strong></p>

<pre><code>package com.miahollins.basketballfinal;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class Status extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.status);
}

public void load(View view){
    try {
        String Stats;
        FileInputStream fileInputStream = openFileInput("stats");
        InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
        BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
        StringBuffer stringBuffer = new StringBuffer();
        while ((Stats=bufferedReader.readLine())!=null){
            stringBuffer.append(Stats + "\n");

        }
        TextView load = (TextView)findViewById(R.id.textView);
        load.setText(stringBuffer.toString());
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
}
</code></pre>

<p>Any help would be greatly appreciated!</p>