1.获得 RadioButton值
rb1 = (RadioButton)findViewById(R.id.sex1); if (rb1.isChecked()) { sex = "M"; } else { sex = "F"; }
2.两个Activity间传递数据
发送方: Intent intent = new Intent(); intent.setClass(EX03_11.this,EX03_11_1.class); Bundle bundle = new Bundle(); bundle.putDouble("height", height); bundle.putString("sex", sex); intent.putExtras(bundle);//打开另一个activity startActivityForResult(intent, 0);接受方: intent =this.getIntent(); bundle=intent.getExtras(); String sex =bundle.getString("sex"); double height =bundle.getDouble("height");
3.打开一个消息框
new AlertDialog.Builder(EX03_12.this) .setTitle(R.string.app_about) .setMessage(R.string.app_about_msg) .setPositiveButton(R.string.str_ok, newDialogInterface.OnClickListener() { publicvoid onClick(DialogInterface dialoginterface, int i) { } }).show();
4.改变文本框的字体
注: 在assets目录下建立fonts文件夹并放入HandmadeTypewriter.ttf字体文件
待续
来自东子的博客
来自东子的博客