开发实例:Android 身高计算器的实现
2010-05-24 00:03:00 来源:WEB开发网adia.show();
return;
}
if(mEeditText.getText().toString().length()< 1)
{
Builder adia=new AlertDialog.Builder(test.this);
adia.setMessage("请输入母亲的身高");
adia.setTitle("提示");
adia.setNeutralButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
mEeditText.setHighlightColor(Color.RED);
}
});
adia.show();
return;
}
mRadioGroup=(RadioGroup)findViewById(R.id.sex);
if(mRadioGroup.getCheckedRadioButtonId()==R.id.F)
{Sex="女孩";}
else
{
Sex="男孩";
}
Intent intent=new Intent();
intent.setClass(test.this,result.class);
fheight=Double.parseDouble(fEeditText.getText().toString());
mheight=Double.parseDouble(mEeditText.getText().toString());
Bundle bun=new Bundle();
bun.putDouble("fheight", fheight);
bun.putDouble("mheight", mheight);
bun.putString("Sex", Sex);
intent.putExtras(bun);
startActivity(intent);
finish();
// BundleObject.this.finish();
}
});
}
}
代码
package app.test;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class result extends Activity {
String Sex;
double fheight;
double mheight;
double cheight;
更多精彩
赞助商链接