package teammemes.tritonbudget;

import android.app.AlertDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.content.Context;
import android.widget.Button;

import android.widget.EditText;
import android.content.SharedPreferences;
import android.widget.Toast;


public class Enter_Info extends AppCompatActivity {
    // backend
    //Database mydb;
    //MenuDataSource menuDS;
    // frontend
    private EditText name;
    private EditText money;
    //private EditText id;
    private Button btnDone;
    SharedPreferences sharedpreferences;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_enter__info);
        // Frontend inti.
        name = (EditText) findViewById(R.id.EnterName);
        money = (EditText) findViewById(R.id.EnterMoney);
        btnDone = (Button) findViewById(R.id.btnConfirm);
        sharedpreferences= getSharedPreferences("mypref", Context.MODE_PRIVATE);

        // add data button
        addData();

    }

    public void addData() {
        btnDone.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        SharedPreferences.Editor editor = sharedpreferences.edit();
                        editor.putString("name", name.getText().toString());
                        editor.putString("balance", money.getText().toString());
                        editor.commit();
                        Toast.makeText(Enter_Info.this,"Thanks",Toast.LENGTH_LONG).show();
                        Intent intent = new Intent(getApplicationContext(), HomeScreen.class);
                        startActivity(intent);
                    }

                }
        );
    }


}

@@ -221,16 +221,46 @@
 Button;%0A
+import android.content.Intent;
 %0Aimport 

Update Enter_Info.java