I have made a simple android app,i that some calculations are there from 1 activity’s EditText value some multiplication,sum and other mathematical procedures and showing results as double in another activities edittexs.so can anyone please tell me is it necessary to cast string value to “double” for making calculation and how can i do it?
Activity1.java
Intent ic = new Intent(Calculator_1Activity.this,Calculator2a.class);
ic.putExtra("e1", et1.getText().toString());
ic.putExtra("e2", et2.getText().toString());
ic.putExtra("e3", et3.getText().toString());
ic.putExtra("e4", et4.getText().toString());
ic.putExtra("e5", et5.getText().toString());
ic.putExtra("e6", et6.getText().toString());
ic.putExtra("e7", et7.getText().toString());
ic.putExtra("e8", et8.getText().toString());
startActivity(ic);
and i fetch its values in activity2a,but can’t do calculations….pls help..:(
Activity2a.java
Intent receiveIntent = this.getIntent();
String etz1 = receiveIntent.getStringExtra("e1");
String etz2 = receiveIntent.getStringExtra("e2");
String etz3 = receiveIntent.getStringExtra("e3");
String etz4 = receiveIntent.getStringExtra("e4");
String etz5 = receiveIntent.getStringExtra("e5");
String etz6 = receiveIntent.getStringExtra("e6");
String etz7 = receiveIntent.getStringExtra("e7");
String etz8 = receiveIntent.getStringExtra("e8");
et1.setText(etz1);
et2.setText(etz2);
et3.setText(etz3);
et4.setText(etz4);
et5.setText(etz5);
et6.setText(etz6);
et7.setText(etz7);
et8.setText(etz8);
please help me
do something like below
Edit:- for casting double to string, there are many ways can do something like below