摘要: import java.io.IOException;import android.content.Context; /* 写文件的代码 */ try { FileOutputStream outStream =main.this.openFileOutput("itcast.txt", Context.MODE_PRIVATE); outStream.write("文件写入".getBytes()); outStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); 阅读全文
posted @ 2011-09-17 09:43 jetz 阅读(283) 评论(0) 推荐(0) 编辑
摘要: import android.app.AlertDialog;import android.content.DialogInterface; new AlertDialog.Builder (this) .setTitle ("Alerting Message") .setMessage ("你好!") .setPositiveButton("确定",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, 阅读全文
posted @ 2011-09-17 09:42 jetz 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Bundle bunde = this.getIntent().getExtras();double height = Double.parseDouble(bunde.getString("KEY_HEIGHT"))/100;double weight = Double.parseDouble(bunde.getString("KEY_WEIGHT")); 阅读全文
posted @ 2011-09-17 09:40 jetz 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Uri uri = Uri.parse("http://androidbmi.googlecode.com/");Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent); 阅读全文
posted @ 2011-09-17 09:38 jetz 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 发送intent.setClass(Bmi.this, Report.class);Bundle bundle = new Bundle();bundle.putString("KEY_HEIGHT", field_height.getText().toString());bundle.putString("KEY_WEIGHT", field_weight.getText().toString());intent.putExtras(bundle);startActivity(intent);接收解析Bundle bunde = this.getInt 阅读全文
posted @ 2011-09-17 09:37 jetz 阅读(249) 评论(0) 推荐(0) 编辑
摘要: Uri uri = Uri.parse(getString(R.string.homepage_uri)); 阅读全文
posted @ 2011-09-17 09:37 jetz 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 保存偏好 @Override protected void onPause(){ super.onPause(); // Save user preferences. use Editor object to make changes. SharedPreferences settings = getSharedPreferences(PREF, 0); settings.edit() .putString(PREF_HEIGHT, field_height.getText().toString()) .commit(); }获取偏好 // Restore preferences privat 阅读全文
posted @ 2011-09-17 09:36 jetz 阅读(208) 评论(0) 推荐(0) 编辑