package com.example.fitness_application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
/**
* Created by Денис on 28.02.2017.
*/
public class ActivityCalc extends AppCompatActivity {
private TextView Sum = (TextView) findViewById(R.id.textView9);
public static final String APP_PREFERENCES = "mysettings";
public static final String APP_PREFERENCES_SUM = "Sum"; // сумма в калькуляторе
SharedPreferences mSettings;
private double a, b, c, d;
private double n = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calc);
// mSettings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE);
//
// String strNickName = Sum.getText().toString();
//
// SharedPreferences.Editor editor = mSettings.edit();
// editor.putString(APP_PREFERENCES_SUM, strNickName);
// editor.apply();
}
public void ClickMilk(View view) {
a = 60;
n = n + a;
String N = Double.toString(n);
Sum.setText(N);
}
public void ClickChick(View view) {
b = 200;
n = n + b;
String N = Double.toString(n);
Sum.setText(N);
}
public void ClickBuckwheat(View view) {
c = 132;
n = n + c;
String N = Double.toString(n);
Sum.setText(N);
}
public void ClickPaste(View view) {
d = 588;
n = n + d;
String N = Double.toString(n);
Sum.setText(N);
}
// public void ClickNewProd(View view) {
//
// }
}
private TextView Sum = (TextView) findViewById(R.id.textView9);
public class ActivityCalc extends AppCompatActivity {
private TextView Sum;
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calc);
...
Sum = (TextView) findViewById(R.id.textView9)