Linux教程網
拍照方法。來個簡單的:
- try {
- Intent i = new Intent("Android.media.action.IMAGE_CAPTURE");
- startActivityForResult(i, Activity.DEFAULT_KEYS_DIALER);
- } catch (Exception e) {
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
-
- Bundle extras = data.getExtras();
- Bitmap b = (Bitmap) extras.get("data");
-
- ImageView img = new ImageView(this);
- img.setImageBitmap(b);
- setContentView(img);
- }
OK.
Copyright ©
Linux教程網 All Rights Reserved