I'm trying to save a bitmap to my directory but haven't a little trouble.
What my applications does is:
1.Opens the inbuilt camera application by an Intent.
public void openCamera() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory()+ File.separator + "image.jpg");
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
2.It then stores the picture intent into 'REQUEST_IMAGE_CAPTURE' and saves the image into a temp directory.
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
3.Which is then converted into a bitmap and loaded from the tmp directory into an image view
protected void onActivityResult(int requestCode, int resultCode, Intent data){
//Check that request code matches ours:
if (requestCode == REQUEST_IMAGE_CAPTURE){
//Get our saved file into a bitmap object:
File file = new File(Environment.getExternalStorageDirectory()+File.separator + "image.jpg");
Bitmap image = decodeSampledBitmapFromFile(file.getAbsolutePath(), 1000, 700);
imageView.setImageBitmap(image);
}
}
Now, how do i save the bitmap which in the imageview into the picture directory?
I have inputted the permissions into my manifest
<uses-feature android:name="android.hardware.camera"
android:required="true" />
...
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
...
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>