【发布时间】:2012-04-17 20:27:46
【问题描述】:
我正在做一个项目,通过ImageView从drawable文件夹中读取图像文件,它通过成功加载
ImageView view = (ImageView) findViewById(R.id.imageView);
view.setOnTouchListener(this);
buttonTakePicture = (Button) findViewById(R.id.takepicture);
buttonTakePicture.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
camera.takePicture(myShutterCallback, myPictureCallback_RAW,
myPictureCallback_JPG);
现在按下takePicture按钮后,图像应该保存在sdcard中,它正在拍摄快照但不保存图像,代码如下
File file = new File(mScreenshotPath + "/" + System.currentTimeMillis() + ".jpg");
FileOutputStream fos;
try {
imageFileOS = getContentResolver().openOutputStream(uriTarget);
imageFileOS.write(arg0);
imageFileOS.flush();
imageFileOS.close();
fos = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
Toast.makeText(AndroidCamera.this,
"Image saved: " + uriTarget.toString(),
Toast.LENGTH_LONG).show();
请帮我解决这个问题....在此先感谢
【问题讨论】:
标签: android image camera save drawable