Unable to access my sharedpreferences and calculate - android

I made an Android app wherein I receive text and numeric (decimal) values from user in 5 different activities then store them in my sharedpreferences. I am able to restore all values using editor(); in all previous 5 activities.
Now
In final calculation activity I'm restoring all user input (text and numbers) and storing them in string and double variables. performing calculations in below posted code activity;
Problem
I am unable to view results in textview using getText.
Is there anything missing?
public class Xcalculateforall extends Activity {
Button qcbut, coatsolbut;
TextView TVqcbut, TVcoatsolbut, TVbrand;
double tdrum, rqctotal;
String a;
public static String FILE1 = "MyPrefsFile";
SharedPreferences abcPref;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.resultmain);
qcbut = (Button) findViewById(R.id.bQCS);
coatsolbut = (Button) findViewById(R.id.bCSP);
TVqcbut = (TextView) findViewById(R.id.tvQCS);
TVbrand = (TextView) findViewById(R.id.tvBrand);
TVcoatsolbut = (TextView) findViewById(R.id.tvCSP);
abcPref = this.getSharedPreferences(FILE1, 0);
a = abcPref.getString("tA", ""); //receives text value and store in 'a' String
double k = Integer.parseInt(abcPref.getString("tsK", ""));
double l = Integer.parseInt(abcPref.getString("tsL", ""));
double m = Integer.parseInt(abcPref.getString("tsM", ""));
double n = Integer.parseInt(abcPref.getString("tsN", ""));
double o = Integer.parseInt(abcPref.getString("tsO", ""));
double p = Integer.parseInt(abcPref.getString("tsP", ""));
tdrum = 20 / m;
double samv = (tdrum / k) / l;
double samv2 = (Math.sqrt(samv));
double tsample = ((samv2 + 1) * k) * l;
double rmicro = tsample * n;
double rchem = tsample * o;
double rother = tsample * p;
double rinqc = rmicro + rchem + rother;
rqctotal = rinqc - 2;
qcbut.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
TVqcbut.setText(rqctotal + "Days");
TVbrand.setText("" + a);
// Intent results = new Intent("com.traviss.calculate.RESULT");
// startActivity(results);
}
});
}
}
Updating query --- previous activity where i take user input
public class G2J extends Activity {
Button two2five, save2;
EditText edtG, edtH, edtI, edtJ, edtK;
int tG, tH, tI, tJ, tK;
String tsG, tsH, tsI, tsJ, tsK;
public static String FileP2 = "MyPrefsFile";
SharedPreferences abcPref;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.g2j);
two2five = (Button) findViewById(R.id.btp2);
edtG = (EditText) findViewById(R.id.etG);
edtH = (EditText) findViewById(R.id.etH);
edtI = (EditText) findViewById(R.id.etI);
edtJ = (EditText) findViewById(R.id.etJ);
edtK = (EditText) findViewById(R.id.etK);
abcPref = getSharedPreferences(FileP2, 0);
edtG.setText(abcPref.getString("tsG", ""));
edtH.setText(abcPref.getString("tsH", ""));
edtI.setText(abcPref.getString("tsI", ""));
edtJ.setText(abcPref.getString("tsJ", ""));
edtK.setText(abcPref.getString("tsK", ""));
two2five.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if ((!edtG.getText().toString().equals(""))
&& (!edtH.getText().toString().equals(""))
&& (!edtI.getText().toString().equals(""))
&& (!edtJ.getText().toString().equals(""))
&& (!edtK.getText().toString().equals(""))) {
abcPref = G2J.this.getSharedPreferences(FileP2, 0);
SharedPreferences.Editor editor = abcPref.edit();
editor.putString("tsG", edtG.getText().toString());
editor.putString("tsH", edtH.getText().toString());
editor.putString("tsI", edtI.getText().toString());
editor.putString("tsJ", edtJ.getText().toString());
editor.putString("tsK", edtK.getText().toString());
editor.commit();
Toast message = Toast.makeText(G2J.this, "Values are saved", 2000);
message.setGravity(Gravity.BOTTOM, 0, 0);
message.show();
Intent openl2p = new Intent("com.traviss.calculate.L2P");
startActivity(openl2p);
}
else {
Toast failz = Toast.makeText(G2J.this,
"Values are not Entered", 2000);
failz.setGravity(Gravity.BOTTOM, 0, 0);
failz.show();
}
};
});
}
}

check your string variables and xml layout

Try -
int k = Integer.parseInt(abcPref.getString("tsK", ""));

You wont get decimal values using Integer.parseInt(String)
Do this
double k = Double.parseDouble(abcPref.getString("tsK", ""));
a = String.valueOf(abcPref.getString("tA", ""));

Related

High score returns to 0

Please help me, code below
The textview is always 0 when i close and start my app.
EDIT
The full code is now added.
TextView txt = (TextView)findViewById(R.id.textView23);
int mynum1 = ea1.TimeCounter++;
int mynum2 = ea2.TimeCounter++;
int mynum3 = ea3.TimeCounter++;
int mynum4 = ea4.TimeCounter++;
int mynum5 = ea5.TimeCounter++;
int mynum6 = ea6.TimeCounter++;
in = (mynum1) + (mynum2) + (mynum3) + (mynum4) + (mynum5) + (mynum6) ;
txt.setText(Integer.toString(in));
TextView tt = (TextView)findViewById(R.id.textView26);
SharedPreferences sps = getSharedPreferences(PREFS, 0);
String ss = sps.getString("Score", "Nothing Found");
tt.setText(ss);
Button btn = (Button)findViewById(R.id.button8);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
TextView txt = (TextView)findViewById(R.id.textView23);
TextView tt = (TextView)findViewById(R.id.textView26);
if (Integer.parseInt(txt.getText().toString()) < Integer.parseInt(tt.getText().toString())) {
String current = txt.getText().toString();
SharedPreferences sp = getSharedPreferences(PREFS, 0);
SharedPreferences.Editor editor = sp.edit();
editor.putString("Score", in);
editor.commit();
tt.setText(current);
}
else if(Integer.parseInt(txt.getText().toString()) > Integer.parseInt(tt.getText().toString())) {
SharedPreferences sps = getSharedPreferences(PREFS, 0);
String ss = sps.getString("Score", "Nothing Found");
tt.setText(ss);
}
}
});
So now i got an answer
new Thread(new Runnable() {
public void run() {
TextView txt = (TextView)findViewById(R.id.textView23);
int mynum1 = ea1.TimeCounter++;
int mynum2 = ea2.TimeCounter++;
int mynum3 = ea3.TimeCounter++;
int mynum4 = ea4.TimeCounter++;
int mynum5 = ea5.TimeCounter++;
int mynum6 = ea6.TimeCounter++;
in = (mynum1) + (mynum2) + (mynum3) + (mynum4) + (mynum5) + (mynum6) ;
txt.setText(Integer.toString(in));
TextView tt = (TextView)findViewById(R.id.textView26);
SharedPreferences sps = getSharedPreferences(PREFS, 0);
String ss = sps.getString("Score", "0");
tt.setText(ss);
Button btn = (Button)findViewById(R.id.button8);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
TextView txt = (TextView)findViewById(R.id.textView23);
TextView tt = (TextView)findViewById(R.id.textView26);
if (Integer.parseInt(txt.getText().toString()) > Integer.parseInt(tt.getText().toString())) {
String current = Integer.toString(in);
SharedPreferences sp = getSharedPreferences(PREFS, 0);
SharedPreferences.Editor editor = sp.edit();
editor.putString("Score", current);
editor.commit();
tt.setText(current);
}
else if(Integer.parseInt(txt.getText().toString()) < Integer.parseInt(tt.getText().toString())) {
SharedPreferences sps = getSharedPreferences(PREFS, 0);
String ss = sps.getString("Score", "Nothing Found");
tt.setText(ss);
}
}
});
}
}).start();
}

sharedPreference or onSaveInstanceState on an EditText/TextView result

I have a little test project below. All I want to do is save the EditText numbers entered and TextView result (thing1, thing2, result) . What's best? onSaveInstanceState, sharedPreference, or something different like SQLite?
I've frustratingly tried the first two (for probably embarrassingly too long), but couldn't figure it out. Could someone please help by adding it to the code below?
public class MainActivity extends ActionBarActivity {
EditText thing1;
EditText thing2;
TextView result;
double n1=0;
double n2=0;
double total=0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button divideButton = (Button) findViewById(R.id.divideButton);
divideButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
thing1 = (EditText) findViewById(R.id.thing1);
if (TextUtils.isEmpty(thing1.getText().toString())) {
n1 = 0;}
else {
n1= Double.parseDouble(thing1.getText().toString());
}
thing2 = (EditText) findViewById(R.id.thing2);
if (TextUtils.isEmpty(thing2.getText().toString())) {
n2 = 0;}
else {
n2 = Double.parseDouble(thing2.getText().toString());
}
if (n2 !=0){
total = (n1 / n2);}
final double total = ((double)n1/(double)n2);
final TextView result= (TextView) findViewById(R.id.result);
String foo = String.format("%.2f", total);
result.setText(foo);
}
});
final Button addButton = (Button) findViewById(R.id.addButton);
addButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
thing1 = (EditText) findViewById(R.id.thing1);
if (TextUtils.isEmpty(thing1.getText().toString())) {
n1 = 0;}
else {
n1= Double.parseDouble(thing1.getText().toString());
}
thing2 = (EditText) findViewById(R.id.thing2);
if (TextUtils.isEmpty(thing2.getText().toString())) {
n2 = 0;}
else {
n2 = Double.parseDouble(thing2.getText().toString());
}
final double total = (n1+n2);
final TextView result= (TextView) findViewById(R.id.result);
String foo = String.format("%.2f", total);
result.setText(foo);
}
});
final Button subtractButton = (Button) findViewById(R.id.subtractButton);
subtractButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
thing1 = (EditText) findViewById(R.id.thing1);
if (TextUtils.isEmpty(thing1.getText().toString())) {
n1 = 0;}
else {
n1= Double.parseDouble(thing1.getText().toString());
}
thing2 = (EditText) findViewById(R.id.thing2);
if (TextUtils.isEmpty(thing2.getText().toString())) {
n2 = 0;}
else {
n2 = Double.parseDouble(thing2.getText().toString());
}
final double total = (n1-n2);
final TextView result= (TextView) findViewById(R.id.result);
String foo = String.format("%.2f", total);
result.setText(foo);
}
});
final Button multiplyButton = (Button) findViewById(R.id.multiplyButton);
multiplyButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
thing1 = (EditText) findViewById(R.id.thing1);
if (TextUtils.isEmpty(thing1.getText().toString())) {
n1 = 0;}
else {
n1= Double.parseDouble(thing1.getText().toString());
}
thing2 = (EditText) findViewById(R.id.thing2);
if (TextUtils.isEmpty(thing2.getText().toString())) {
n2 = 0;}
else {
n2 = Double.parseDouble(thing2.getText().toString());
}
final double total = (n1*n2);
final TextView result= (TextView) findViewById(R.id.result);
String foo = String.format("%.2f", total);
result.setText(foo);
}
});
}
If you will just use the values later like when you open your application, you
can use the SharedPreferences. Based on your code above you can add the code below
to save your EditText data to SharedPreferences and restore it later.
To save your EditText value:
SharedPreferences sharedPreferences = getApplication().getSharedPreferences("ProjectName", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("thing1", thing1.getText.toString());
editor.commit();
To get the value from SharedPreferences you can do this in your onCreate function:
SharedPreferences sharedPreferences = getApplication().getSharedPreferences("ProjectName", MODE_PRIVATE);
String sValue = sharedPreferences.getString("thing1", "default");
thing1.setText( sValue );

Need help formatting with shared preference saving

I have a simple shop activity which uses SharedPreferences to store various data. The problem is that when I click on purchase, I can purchase it multiple times and each time it takes the money from the coins value away. Please help me with this.
This is my code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getActionBar().hide();
setContentView(R.layout.shop_layout);
ImageButton lives = (ImageButton) findViewById(R.id.lives);
final Button hardmode = (Button) findViewById(R.id.hardmode);
final Button reversedMode = (Button) findViewById(R.id.reversedmode);
final SharedPreferences shop = getSharedPreferences("Shop", Context.MODE_PRIVATE);
final int[] livesPrice = {shop.getInt("livesPrice", 10)};
final int[] hardmodePrice = {shop.getInt("hardmodePrice", 15)};
final int[] reversedModePrice = {shop.getInt("reverseModePrice", 20)};
final int[] coins = {shop.getInt("money", 10000)};
final boolean[] hardmodeBoolean = {shop.getBoolean("hardmode", false)};
final boolean[] reversedModeBoolean = {shop.getBoolean("reversedMode", false)};
if(hardmodeBoolean[0]){
hardmode.setText("Purchased");
}
if(reversedModeBoolean[0]){
reversedMode.setText("Purchased");
}
TextView price1 = (TextView) findViewById(R.id.price1);
final TextView money = (TextView) findViewById(R.id.money);
Typeface tf = Typeface.createFromAsset(getAssets(), "font/cricket.ttf");
price1.setTypeface(tf);
price1.setText("=" + livesPrice[0]);
money.setTypeface(tf);
money.setText("Coins " + String.valueOf(coins[0]));
lives.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if (coins[0] >= livesPrice[0]) {
coins[0] = coins[0] - livesPrice[0];
livesPrice[0] = livesPrice[0] + 10;
int numberOfLives = shop.getInt("numberOfLives", 1);
numberOfLives = numberOfLives + 1;
SharedPreferences.Editor editor = shop.edit();
editor.putInt("numberOfLives", numberOfLives);
editor.putInt("money", coins[0]);
editor.commit();
money.setText("Coins " + String.valueOf(coins[0]));
}
}
});
hardmode.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
SharedPreferences.Editor editor = shop.edit();
if (coins[0] >= hardmodePrice[0]) {
coins[0] = coins[0] - hardmodePrice[0];
editor.putBoolean("hardmode", true);
editor.putInt("hardmodePrice", 0);
editor.putInt("money", coins[0]);
editor.apply();
money.setText("Coins " + String.valueOf(coins[0]));
hardmode.setText("Purchased");
hardmodeBoolean[0] = shop.getBoolean("hardmode", true);
}
}
});
reversedMode.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
SharedPreferences.Editor editor = shop.edit();
if (coins[0] >= reversedModePrice[0]) {
coins[0] = coins[0] - reversedModePrice[0];
editor.putBoolean("reversedMode", true);
editor.putInt("reversedModePrice", 0);
editor.putInt("money", coins[0]);
editor.apply();
money.setText("Coins " + String.valueOf(coins[0]));
reversedMode.setText("Purchased");
reversedModeBoolean[0] = shop.getBoolean("reversedMode", true);
}
}
});
}
try changing
coins[0] = coins[0] - livesPrice[0];
To
coins[0] -= livesPrice[0] ;

Calculation on textwatcher not working properly in android

I have made an android activity,In that multiple LinearLayouts are inflated on a "plus" button,Now in each Layout i am having 2 edittext and a textView,I want to do multiplication of that edittexts and display to textView,its working fine,But i am so much confused when multiple linearLayouts are binded,because i want all the textview values's sum at the end,I have tried as below,but getting wrong values.
code
add.setOnClickListener(new OnClickListener()){
#Override
onClick(){
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View addView = layoutInflater.inflate(R.layout.raw_descs, null);
ImageView buttonRemove = (ImageView) addView.findViewById(R.id.iv_del);
et_item_id = (EditText) addView.findViewById(R.id.et_item_id);
et_desc = (EditText) addView.findViewById(R.id.et_desc);
et_qty = (EditText) addView.findViewById(R.id.et_qty);
et_unit_prize = (EditText) addView.findViewById(R.id.et_unit_prize);
et_amt = (EditText) addView.findViewById(R.id.et_amt);
et_qty.addTextChangedListener(textwatcher);
et_unit_prize.addTextChangedListener(textwatcher);
buttonRemove.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
((LinearLayout) addView.getParent()).removeView(addView);
// calculate();
if (cnt >= 0) {
cnt = cnt - 1;
}
}
});
cnt = cnt + 1;
listitems.setTag(cnt);
listitems.addView(addView);
}
}
private void calculateInvoice() {
double QuantyInt = 1;
double PriceInt = 0;
double discountInt = 0;
double shipInt = 0;
for (int i = 0; i < listitems.getChildCount(); i++) {
et_qty = (EditText) ((RelativeLayout) listitems.getChildAt(i)).getChildAt(4);
et_amt = (EditText) ((RelativeLayout) listitems.getChildAt(i)).getChildAt(8);
et_unit_prize = (EditText) ((RelativeLayout) listitems.getChildAt(i)).getChildAt(6);
if (et_qty != null) {
QuantyInt = Double.parseDouble(!et_qty.getText().toString().equals("") ? et_qty.getText().toString() : "0");
}
if (et_unit_prize != null) {
PriceInt = Double.parseDouble(!et_unit_prize.getText().toString().equals("") ? et_unit_prize.getText().toString() : "0");
}
subtotal = (QuantyInt * PriceInt);
}
double textResult = subtotal;
System.out.println("::::::::::::MY TOATAL PRICE::::::::::::::::>>>>>>>>>>>>>>>>" + subtotal);
et_amt.setText("$" + textResult + "");
double finaltotal = 0;
for (int i = 0; i < subtotl.size(); i++) {
System.out.println(":::::::::::::Subtotal values+++++++++++:::::::::::>>>>>>>>>>>>>>" + subtotl.get(i));
finaltotal = finaltotal + Double.parseDouble(subtotl.get(i));
}
System.out.println(":::::::::::::Subtotal:::::::::::>>>>>>>>>>>>>>" + finaltotal);
tv_pre.setText("$" + finaltotal + "");
if (et_dis != null) {
discountInt = Double.parseDouble(!et_dis.getText().toString().equals("") ? et_dis.getText().toString() : "0");
}
discount = ((finaltotal * discountInt) / 100);
double txtdiscount = discount;
tv_dis.setText("$" + txtdiscount + "");
double totl1 = finaltotal - discount;
tv_total.setText("$" + totl1 + "");
if (et_ship != null) {
shipInt = Double.parseDouble(!et_ship.getText().toString().equals("") ? et_ship.getText().toString() : "0");
}
tv_ship.setText("$" + et_ship.getText().toString());
double fnltotl = (shipInt + totl1);
tv_total.setText("$" + fnltotl + "");
}
TextWatcher textwatcher = new TextWatcher() {
#Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
#Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
#Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
calculateInvoice();
}
};
you don't need to get the String in editText which you registered a TextWatcher for that again . just pass that CharSequence from onTextChanged() to calculateInvoice(arg0) and do your calculation based on arg0.

Putting double value into TextView

In my Android app I am calculating a double value using values entered into EditTexts and trying to put the answer into a TextView. My code is this:
double scoreDouble;
TextView score;
EditText gpa;
EditText sat;
EditText act;
Button calc;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gpa = (EditText) findViewById(R.id.gpa);
String gpaString = gpa.getText().toString();
if(gpaString.equals("")){
gpaString = "0";
}
final double gpaDouble = Double.parseDouble(gpaString);
sat = (EditText) findViewById(R.id.sat);
String satString = sat.getText().toString();
if(satString.equals("")){
satString = "0";
}
final int satInt = Integer.parseInt(satString);
act = (EditText) findViewById(R.id.act);
String actString = act.getText().toString();
if(actString.equals("")){
actString = "0";
}
final int actInt = Integer.parseInt(actString);
score = (TextView) findViewById(R.id.score);
calc = (Button) findViewById(R.id.calc);
calc.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if(actInt/36>satInt/2400){
scoreDouble= (0.6*gpaDouble*25)+(0.4*(actInt/36)*100);
String scoreString = Double.toString(scoreDouble);
score.setText("Your score is "+scoreString);
}else{
scoreDouble = (0.6*gpaDouble*25)+(0.4*(satInt/2400)*100);
String scoreString = Double.toString(scoreDouble);
score.setText("Your score is "+scoreString);
}
}
});
}
As of now, when the button is pressed the TextView says: "Your score is 0.0." I feel this has something to do with the fact that I set the default values of the EditTexts to 0. Before I did this, I was getting an error stating NumberFormatException: invalid double: "". If this is the problem, how should I fix it. If that is not the problem, what it?
You define the actInt and satInt as final variables, and they will be assigned to a value only once (when the execution of the onCreate method) and the initial value will be zero as at the begining the edittext contain nothing.
To solve this issue:
move he actInt and satInt from local variables to a field variables and remove the final keyword. (I mean define those variables as a private variables inside the class) and assign the values for the variables inside the onclick Method.
public class test extends Activity {
double scoreDouble;
TextView score;
EditText gpa;
EditText sat;
EditText act;
Button calc;
private int satInt;
private int actInt;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gpa = (EditText) findViewById(R.id.gpa);
sat = (EditText) findViewById(R.id.sat);
act = (EditText) findViewById(R.id.act);
score = (TextView) findViewById(R.id.score);
calc = (Button) findViewById(R.id.calc);
calc.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String gpaString = gpa.getText().toString();
if (gpaString.equals("")) {
gpaString = "0";
}
double gpaDouble = Double.parseDouble(gpaString);
String satString = sat.getText().toString();
if (satString.equals("")) {
satString = "0";
}
int satInt = Integer.parseInt(satString);
String actString = act.getText().toString();
if (actString.equals("")) {
actString = "0";
}
int actInt = Integer.parseInt(actString);
if (actInt / 36 > satInt / 2400) {
scoreDouble = (0.6 * gpaDouble * 25)
+ (0.4 * (actInt / 36) * 100);
String scoreString = Double.toString(scoreDouble);
score.setText("Your score is " + scoreString);
} else {
scoreDouble = (0.6 * gpaDouble * 25)
+ (0.4 * (satInt / 2400) * 100);
String scoreString = Double.toString(scoreDouble);
score.setText("Your score is " + scoreString);
}
}
});
}
}
You are doing everything on your onCreate method. So all your code is called at the start of your application. At this moment, your EditTexts are empty and your code goes to these parts:
if(gpaString.equals("")){
gpaString = "0";
}
if(actString.equals("")){
actString = "0";
}
if (actString.equals("")) {
actString = "0";
}
Which means that your values gpaDouble, actInt and satInt are equals 0.
Then, you are doing the following:
scoreDouble = (0.6*gpaDouble*25)+(0.4*(satInt/36)*100);
and this:
scoreDouble = (0.6*gpaDouble*25)+(0.4*(satInt/2400)*100);
With the 0 values, your scoreDouble value can only be equal to 0.
To fix it, get your EditTexts' texts in the onClick method of your Button.

Categories

Resources