我把图像存储到我的sdcard和存储到db的文件名路径中

时间:2015-09-11 07:24:07

标签: android cordova

捕获的图像存储在SD卡中,并且用于从sdcard查看数据,路径名称存储在数据库中。但有时路径在db中被保存为NULL。

// click on camera
takePic.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // take pic
            if((takePicRedBtn.isChecked())) {

                    captureImage();//capture image 

            }});
    }

//capturing image
private void captureImage() {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);

    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);

    // start the image capture Intent
    startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);

}

// inside on Activity Result
if(requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE)  
{
   if (resultCode == Activity.RESULT_OK) {
        // successfully captured the image

        //here i insert path name into db       
        takePicIntoDb();
    }   

0 个答案:

没有答案