我有这个应用程序,当我在editText
第一个活动中输入一些值时,即ActivityA
然后按 aButton
会在下一个活动中显示结果,即ActivityB
。但是当我恢复ActivityA
并更改一些值并按下按钮以便我想要ActivityC
调用另一个值时,ActivityB
只会出现。
但是如果我重新启动我的应用程序并输入获取所需的值,ActivityC
我会得到它。我应该如何解决这个问题?
编辑: 活动A
package com.example.iolcalci;
import java.text.DecimalFormat;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class Selection extends Activity implements OnFocusChangeListener{
private EditText k1_e,k2_e,al_e,alconst_e,dr_e;
TextView k1_m,k2_m;
private float k1,k2,al,al_const,dr,Avg_k,v_k1,v_k2,v_dr;
private Float srkt_rnd,srk2_rnd,holladay_rnd,binkhorst_rnd,IOLPower_srkt,IOLPower_srk2,IOLPower_bink,IOLPower_holl;
private float srkt_rf2,srkt_rf3,srkt_rf4,srkt_rf5,srkt_rf6,srkt_rf7,srkt_rf8,srkt_rf9,srkt_rf10,srkt_rf11,srkt_rf12;
private float holladay_rf2,holladay_rf3,holladay_rf4,holladay_rf5,holladay_rf6,holladay_rf7,holladay_rf8,holladay_rf9,holladay_rf10,holladay_rf11,holladay_rf12;
private float binkhorst_rf2,binkhorst_rf3,binkhorst_rf4,binkhorst_rf5,binkhorst_rf6,binkhorst_rf7,binkhorst_rf8,binkhorst_rf9,binkhorst_rf10,binkhorst_rf11,binkhorst_rf12;
private Spinner spin;
private Button result;
private int spinSelected=-1;
int flag = 0;
String k1_s,k2_s,al_s,al_const_s,dr_s;
TextWatcher k1e,k2e,ale,dre;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.selective);
setupUI(findViewById(R.id.form_layout));
spin=(Spinner)findViewById(R.id.formulae);
spin.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos,
long id) {
// TODO Auto-generated method stub
spinSelected=pos;
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
spinSelected=-1;
}
});
dr_e=(EditText)findViewById(R.id.dr_editText);
k1_e=(EditText)findViewById(R.id.k1_editText);
k2_e=(EditText)findViewById(R.id.K2_editText);
al_e=(EditText)findViewById(R.id.al_editText);
alconst_e=(EditText)findViewById(R.id.al_const_editText);
k1_m=(TextView)findViewById(R.id.k1_metric);
k2_m=(TextView)findViewById(R.id.k2_metric);
dr_e.setText("0.0");
dr_e.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
dr_s=dr_e.getText().toString();
v_dr=Float.valueOf(dr_s);
}
});
al_e.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(!hasFocus){
al_s = al_e.getText().toString();
int dotPos = -1;
for (int i = 0; i < al_s.length(); i++) {
char c = al_s.charAt(i);
if (c == '.') {
dotPos = i;
}
}
if (dotPos == -1){
if(al_s.length()==0){
al_e.setText("0.00");
}else{
al_e.setText(al_s + ".00");
}
} else {
if ( al_s.length() - dotPos == 1 ) {
al_e.setText(al_s + "00");
} else if ( al_s.length() - dotPos == 2 ) {
al_e.setText(al_s + "0");
}
}
}
}
});
k1_e.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(!hasFocus){
String k1_s = k1_e.getText().toString();
int dotPos = -1;
for (int i = 0; i < k1_s.length(); i++) {
char c = k1_s.charAt(i);
if (c == '.') {
dotPos = i;
}
}
if (dotPos == -1){
if(k1_s.length()==0){
k1_e.setText("0.00");
}else{
k1_e.setText(k1_s + ".00");
}
} else {
if ( k1_s.length() - dotPos == 1 ) {
k1_e.setText(k1_s + "00");
} else if ( k1_s.length() - dotPos == 2 ) {
k1_e.setText(k1_s + "0");
}
}
}
k1_s=k1_e.getText().toString().trim();
k1_e.setText(String.format(k1_s,"##.00"));
if(k1_s.length()!=0){
k1=Float.parseFloat(k1_s);
v_k1=Float.valueOf(k1);
Log.v("K1",""+v_k1);
if((v_k1>=(float)5.63)&&(v_k1<=(float)11.25)){
k1_m.setText("mm");
Log.v("CHECK1", "success1" +v_k1);
}else if((v_k1>=(float)30)&&(v_k1<=(float)60)){
k1_m.setText("D");
Log.v("CHECK1", "success1" +v_k1);
}else{
}
}
}
});
k2_e.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(!hasFocus){
String k2_s = k2_e.getText().toString();
int dotPos = -1;
for (int i = 0; i < k2_s.length(); i++) {
char c = k2_s.charAt(i);
if (c == '.') {
dotPos = i;
}
}
if (dotPos == -1){
if(k2_s.length()==0){
k2_e.setText("0.00");
}else{
k2_e.setText(k2_s + ".00");
}
} else {
if ( k2_s.length() - dotPos == 1 ) {
k2_e.setText(k2_s + "00");
} else if ( k2_s.length() - dotPos == 2 ) {
k2_e.setText(k2_s + "0");
}
}
}
k2_s=k2_e.getText().toString().trim();
if(k2_s.length()!=0){
k2=Float.parseFloat(k2_s);
v_k2=Float.valueOf(k2);
Log.v("K2",""+v_k2);
if((v_k2>=5.63)&&(v_k2<=11.25)){
k2_m.setText("mm");
Log.v("CHECK2", "success2" +v_k2);
}else if((v_k2>=30)&&(v_k1<=60)){
k2_m.setText("D");
Log.v("CHECK2", "success2" +v_k2);
}else{
}
}
}
});
result=(Button)findViewById(R.id.result);
result.setOnClickListener(new OnClickListener() {
@SuppressLint("NewApi")
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(dr_e.getText().toString().length()==0|al_e.getText().toString().length()==0|alconst_e.getText().toString().length()==0){
flag=1;
}else{
dr=Float.parseFloat(dr_e.getText().toString());
al=Float.parseFloat(al_e.getText().toString());
al_const=Float.parseFloat(alconst_e.getText().toString());
k1=Float.parseFloat(k1_e.getText().toString().trim());
k2=Float.parseFloat(k2_e.getText().toString().trim());
}
if((v_k1>=(float)5.63)&&(v_k1<=(float)11.25)){
k1=Round((float)(337.5/v_k1),2);
}
if((v_k2>=(float)5.63)&&(v_k2<=(float)11.25)){
k2=Round((float)(337.5/v_k2),2);
}
Avg_k=(k1+k2)/2;
if(spinSelected==0){
IOLPower_srkt=Srkt();
if(flag!=1){
Intent iSrkt=new Intent(Selection.this,Srkt.class);
iSrkt.putExtra("RESULT", IOLPower_srkt);
iSrkt.putExtra("DR", dr);
iSrkt.putExtra("IOL", srkt_rnd);
iSrkt.putExtra("REFER7", srkt_rf7);
iSrkt.putExtra("REFER2", srkt_rf2);
iSrkt.putExtra("REFER3", srkt_rf3);
iSrkt.putExtra("REFER4", srkt_rf4);
iSrkt.putExtra("REFER5", srkt_rf5);
iSrkt.putExtra("REFER6", srkt_rf6);
iSrkt.putExtra("REFER8", srkt_rf8);
iSrkt.putExtra("REFER9", srkt_rf9);
iSrkt.putExtra("REFER10", srkt_rf10);
iSrkt.putExtra("REFER11", srkt_rf11);
iSrkt.putExtra("REFER12", srkt_rf12);
startActivity(iSrkt);
}else{
Intent iSrktx=new Intent(Selection.this,Srkt_x.class);
startActivity(iSrktx);
}
}else if(spinSelected==1){
IOLPower_bink=Binkhorst();
if(flag!=1){
Intent iBinkhorst=new Intent(Selection.this,Binkhorst.class);
iBinkhorst.putExtra("RESULT", IOLPower_bink);
iBinkhorst.putExtra("DR", dr);
iBinkhorst.putExtra("IOL", binkhorst_rnd);
iBinkhorst.putExtra("REFER7", binkhorst_rf7);
iBinkhorst.putExtra("REFER2", binkhorst_rf2);
iBinkhorst.putExtra("REFER3", binkhorst_rf3);
iBinkhorst.putExtra("REFER4", binkhorst_rf4);
iBinkhorst.putExtra("REFER5", binkhorst_rf5);
iBinkhorst.putExtra("REFER6", binkhorst_rf6);
iBinkhorst.putExtra("REFER8", binkhorst_rf8);
iBinkhorst.putExtra("REFER9", binkhorst_rf9);
iBinkhorst.putExtra("REFER10", binkhorst_rf10);
iBinkhorst.putExtra("REFER11", binkhorst_rf11);
iBinkhorst.putExtra("REFER12", binkhorst_rf12);
startActivity(iBinkhorst);
}else{
Intent iBinkhorstx=new Intent(Selection.this,Binkhorst_x.class);
startActivity(iBinkhorstx);
}
}else if(spinSelected==2){
IOLPower_srk2=Srk2();
if((Math.ceil(IOLPower_srk2)-IOLPower_srk2)>0.5){
srk2_rnd=(float) Math.floor(IOLPower_srk2);
}else{
srk2_rnd=(float) Math.ceil(IOLPower_srk2);
}
if(flag!=1){
Intent iSrk2=new Intent(Selection.this,Srk2.class);
iSrk2.putExtra("RESULT", IOLPower_srk2);
iSrk2.putExtra("DR", dr);
iSrk2.putExtra("IOL", srk2_rnd);
startActivity(iSrk2);
}else{
Intent iSrk2x=new Intent(Selection.this,Srk2_x.class);
startActivity(iSrk2x);
}
}else{
IOLPower_holl=Holladay();
if(flag!=1){
Intent iHolladay=new Intent(Selection.this,Holladay.class);
iHolladay.putExtra("RESULT", IOLPower_holl);
iHolladay.putExtra("DR", dr);
iHolladay.putExtra("IOL", holladay_rnd);
iHolladay.putExtra("REFER7", holladay_rf7);
iHolladay.putExtra("REFER2", holladay_rf2);
iHolladay.putExtra("REFER3", holladay_rf3);
iHolladay.putExtra("REFER4", holladay_rf4);
iHolladay.putExtra("REFER5", holladay_rf5);
iHolladay.putExtra("REFER6", holladay_rf6);
iHolladay.putExtra("REFER8", holladay_rf8);
iHolladay.putExtra("REFER9", holladay_rf9);
iHolladay.putExtra("REFER10", holladay_rf10);
iHolladay.putExtra("REFER11", holladay_rf11);
iHolladay.putExtra("REFER12", holladay_rf12);
startActivity(iHolladay);
}else{
Intent iHolladayx=new Intent(Selection.this,Holladay_x.class);
startActivity(iHolladayx);
}
}
}
});
Button reset=(Button) findViewById(R.id.reset);
reset.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dr_e.setText("0.0");
al_e.setText("");
k1_e.setText("");
k2_e.setText("");
alconst_e.setText("");
dr_e.requestFocus();
}
});
}
public static float Round(float Rval, int Rpl) {
float p = (float)Math.pow(10,Rpl);
Rval = Rval * p;
float tmp = Math.round(Rval);
return (float)tmp/p;
}
public float Srkt(){
float Rcor;
float Lcor;
float Crwdest;
float Corneal_H;
float Acd_Const;
float Offset;
float Acd_Est;
float Na=(float) 1.336;
float C2=(float) 0.3333;
float C3;
float C4;
float C5;
float C6;
float C8;
float C9;
float Iolam;
float Rcor1=(float)(337.5/Avg_k);Rcor=Round(Rcor1,2);
if(al<=24.2){
Lcor=al;
}else{
Lcor=(float) (-3.446+1.716*al-0.0237*(al*al));
}Lcor=Round(Lcor,2);
Crwdest=(float) (-5.41+0.58412*Lcor+0.098*Avg_k);Crwdest=Round(Crwdest,2);
Corneal_H=(float) (Rcor-(Math.sqrt(Rcor*Rcor-Crwdest*Crwdest/4)));Corneal_H=Round(Corneal_H,2);
Acd_Const=(float) (0.62467*al_const-68.747);
Offset=(float) (Acd_Const-3.336);Offset=Round(Offset,2);
Acd_Est=(Corneal_H+Offset); float Acd_Est1=Round(Acd_Est,2);
C3=(float) (0.97971*al+0.65696);C3=Round(C3,2);
C4=C3-Acd_Est1;C4=Round(C4,2);
C5=(float) ((Na*Rcor)-(C2*Acd_Est)); C5=Round(C5, 2);
C6=(float) ((Na*Rcor1)-(C2*C3));
C8=(float) ((12*C6)+(C3*Rcor1));C8=Round(C8,2);
C9=(float) ((12*C5)+(Acd_Est*Rcor1));C9=Round(C9,2);
Iolam=(float) ((1336*(C6-(0.001*C8*dr)))/(C4*(C5-(0.001*dr*C9))));Iolam=Round(Iolam,2);
if((Math.ceil(Iolam)-Iolam)>0.5){
srkt_rnd=(float) Math.floor(Iolam);
}else{
srkt_rnd=(float) Math.ceil(Iolam);
}
srkt_rf7=(float) (((1336*C6)-(srkt_rnd*C4*C5))/((1.336*C8)-(0.001*srkt_rnd*C4*C9)));
srkt_rf6=(float) (((1336*C6)-((srkt_rnd+0.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd+0.5)*C4*C9)));
srkt_rf5=(float) (((1336*C6)-((srkt_rnd+1)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd+1)*C4*C9)));
srkt_rf4=(float) (((1336*C6)-((srkt_rnd+1.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd+1.5)*C4*C9)));
srkt_rf3=(float) (((1336*C6)-((srkt_rnd+2)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd+2)*C4*C9)));
srkt_rf2=(float) (((1336*C6)-((srkt_rnd+2.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd+2.5)*C4*C9)));
srkt_rf8=(float) (((1336*C6)-((srkt_rnd-0.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd-0.5)*C4*C9)));
srkt_rf9=(float) (((1336*C6)-((srkt_rnd-1)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd-1)*C4*C9)));
srkt_rf10=(float) (((1336*C6)-((srkt_rnd-1.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd-1.5)*C4*C9)));
srkt_rf11=(float) (((1336*C6)-((srkt_rnd-2)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd-2)*C4*C9)));
srkt_rf12=(float) (((1336*C6)-((srkt_rnd-2.5)*C4*C5))/((1.336*C8)-(0.001*(srkt_rnd-2.5)*C4*C9)));
return(Iolam);
}
public float Binkhorst(){
float K1;
float LB2;
float ACDbnk;
float xb;
float yb;
float em;
K1=(float)(337.5/Avg_k);
LB2=(float) (al+0.1984);
if(LB2>=26){
ACDbnk=(float) (((0.58357*al_const)-63.896)*1.1087);
}else{
ACDbnk=(float) (((0.58357*al_const)-63.896)*LB2/23.45);
}
xb=(float) (1336*((1.336*K1-0.3333*LB2)-0.001*dr*(16.032*K1-4*LB2+LB2*K1)));
yb=(float) ((LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk-0.001*dr*(16.032*K1-4*ACDbnk+ACDbnk*K1)));
em=xb/yb;em=Round(em,2);
if((Math.ceil(em)-em)>0.5){
binkhorst_rnd=(float) Math.floor(em);
}else{
binkhorst_rnd=(float) Math.ceil(em);
}
binkhorst_rf7=(float) ((1336*((1.336*K1-0.3333*LB2))-binkhorst_rnd*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*binkhorst_rnd*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf6=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd+0.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd+0.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf5=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd+1)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd+1)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf4=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd+1.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd+1.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf3=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd+2)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd+2)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf2=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd+2.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd+2.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf8=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd-0.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd-0.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf9=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd-1)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd-1)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf10=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd-1.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd-1.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf11=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd-2)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd-2)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
binkhorst_rf12=(float) ((1336*((1.336*K1-0.3333*LB2))-(binkhorst_rnd-2.5)*(LB2-ACDbnk)*(1.336*K1-0.3333*ACDbnk))/(1.336*((16.032*K1)-(4*LB2)+(LB2*K1))-0.001*(binkhorst_rnd-2.5)*(LB2-ACDbnk)*((16.032*K1)-(4*ACDbnk)+(ACDbnk*K1))));
return(em);
}
public float Srk2(){
float X25 = 0;
float Avg_k=(k1+k2)/2;
if(al<20.0){
X25=al_const+3;
}else if((al>=20.0)&&(al<21.0)){
X25=al_const+2;
}else if((al>=21.0)&&(al<22.0)){
X25=al_const+1;
}else if((al>=22.0)&&(al<24.5)){
X25=al_const;
}else if(al>=24.5){
X25=(float) (al_const-(0.5));
}else{
Toast.makeText(getApplicationContext(), "Please enter valid AL value", Toast.LENGTH_SHORT).show();
}
float SRK2 = (float) (X25-(0.9*Avg_k+2.5*al));
return(SRK2);
}
public float Holladay(){
float K;
float Lhol;
float SF;
float Rag;
float AGx;
float AG;
float ACDH;
float CAhol;
float xh;
float yh;
float K1=(float)(337.5/Avg_k);K=Round(K1,2);
Lhol=(float) (al+0.2);
SF=(float) ((0.5663*al_const)-65.6);
if(K<7){
Rag=7;
}else{
Rag=K;
}
AGx=(float) (al*0.533);
if(AGx>13.5){
AG=(float) 13.5;
}else{
AG=AGx;
}
ACDH=(float) (0.56+Rag-(Math.sqrt(Rag*Rag-AG*AG/4)));
CAhol=ACDH+SF;
xh=(float) (1336*((1.336*K1-0.3333*Lhol)-0.001*dr*(16.032*K1-4*Lhol+Lhol*K1)));
yh=(float) ((Lhol-CAhol)*(1.336*K1-0.3333*CAhol-0.001*dr*(16.032*K1-4*CAhol+CAhol*K1)));
float em=xh/yh;em=Round(em,2);
if((Math.ceil(em)-em)>0.5){
holladay_rnd=(float) Math.floor(em);
}else{
holladay_rnd=(float) Math.ceil(em);
}
holladay_rf7=(float) ((1336*((1.336*K1-0.3333*Lhol))-holladay_rnd*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*holladay_rnd*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf6=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd+0.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd+0.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf5=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd+1)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd+1)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf4=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd+1.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd+1.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf3=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd+2)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd+2)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf2=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd+2.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd+2.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf8=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd-0.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd-0.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf9=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd-1)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd-1)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf10=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd-1.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd-1.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf11=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd-2.0)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd-2)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
holladay_rf12=(float) ((1336*((1.336*K1-0.3333*Lhol))-(holladay_rnd-2.5)*(Lhol-CAhol)*(1.336*K1-0.3333*CAhol))/(1.336*((16.032*K1)-(4*Lhol)+(Lhol*K1))-0.001*(holladay_rnd-2.5)*(Lhol-CAhol)*((16.032*K1)-(4*CAhol)+(CAhol*K1))));
return(em);
}
//when the back button is pressed from next activity
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
dr_e.requestFocus();
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
}
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
}
public void setupUI(View view) {
//Set up touch listener for non-text box views to hide keyboard.
if(!(view instanceof EditText)) {
view.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
hideSoftKeyboard(Selection.this);
return false;
}
});
}
//If a layout container, iterate over children and seed recursion.
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
View innerView = ((ViewGroup) view).getChildAt(i);
setupUI(innerView);
}
}
}
}
活动B
package com.example.iolcalci;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Srk2 extends Activity {
private Float Result,dr,Srk2_rnd7,Srk2_rnd2,Srk2_rnd3,Srk2_rnd4,Srk2_rnd5,Srk2_rnd6,Srk2_rnd8,Srk2_rnd9,Srk2_rnd10,Srk2_rnd11,Srk2_rnd12;
private Float Ref2,Ref3,Ref4,Ref5,Ref6,Ref7,Ref8,Ref9,Ref10,Ref11,Ref12;
private float Rf;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_srk2);
Thread srk2=new Thread(){
public void run() {
TextView power=(TextView) findViewById(R.id.srk2_power);
TextView name=(TextView) findViewById(R.id.iolpower);
Result=getIntent().getExtras().getFloat("RESULT");
dr=getIntent().getExtras().getFloat("DR");
if(dr==0){
name.setText("EM :");
}else{
name.setText("AM :");
}
Srk2_rnd7=getIntent().getExtras().getFloat("IOL");
power.setText(String.valueOf(Result));
//some more calculation
}
};
srk2.start();
}
public float refraction(Float ans){
Rf=refer();
return((Result-ans)/Rf);
}
public float refer(){
float Refer;
if(Result>14){
Refer=(float) 1.25;
}else{
Refer=1;
}
return(Refer);
}
}
活动C
package com.example.iolcalci;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
@SuppressLint("NewApi")
public class Srk2_x extends Activity
{
Float result;
@SuppressLint("NewApi")
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_srk2_x);
TextView text = (TextView) findViewById(R.id.srk2_power);
text.setText("INVALID");
}
}