拍照返回的bitmap太小
private void doPhoto(int requestCode) { if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ showToast(this, "请插入SD存储卡"); return; } Intent i = new Intent("android.media.action.IMAGE_CAPTURE"); picPath = Environment.getExternalStorageDirectory() + "/" + System.currentTimeMillis() + ".png"; File file = new File(picPath); Uri imageUri = Uri.fromFile(file); i.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(i, requestCode); }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { this.data = data; switch (requestCode) { case RequestCode_Camera_Self:// 自拍照 if (resultCode == Activity.RESULT_OK) { File file = new File(picPath); Bitmap bmp = createImageThumbnail(picPath,400); byte[] datas = bitmap2Bytes(bmp, CompressFormat.JPEG); tfPhoto.setProperty("text", datas); tfPhoto.setImageBitmap(bmp); // 设置照片现实在界面上 file.delete(); } return;