Search code examples
androidsd-card

how can I store Image in android sdcard from todoit to another folder


I have the number of images from the gallary.

I want to store the selected image into mnt/sdcard/somefolder/image

 IMAGE_PATH = getIntent().getStringExtra(bean.getImagePath());
    imgDisplayImage = (ImageView) findViewById(R.id.imgDisplay);
    Bitmap bitmap = BitmapFactory.decodeFile(IMAGE_PATH);
    System.out.println("IMAGE PATH IN IMAGEDISPLAY CLASS"+ IMAGE_PATH);
    imgDisplayImage.setImageBitmap(bitmap);

Solution

  • Actually i can't understand.. taking pic from camera are set in gallery directly.

    but if you have problem in your surface view then take this code...

    View viewControl = controlInflater.inflate(R.layout.camara_view, null);
            LayoutParams layoutParamsControl = new LayoutParams(
                    LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
            this.addContentView(viewControl, layoutParamsControl);
    
    
        btnGallary = (Button) findViewById(R.id.btnGallery);
        btnCaptureImage = (Button) findViewById(R.id.btnCaptureImage);
        // Button buttonTakePicture = (Button)findViewById(R.id.takepicture);
        btnCaptureImage.setOnClickListener(new Button.OnClickListener() {
    
            @Override
            public void onClick(View arg0) {
                camera.takePicture(myShutterCallback, myPictureCallback_RAW,
                        myPictureCallback_JPG);
            }
        });
    
        btnGallary.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
                // Intent intent = new Intent(getApplicationContext(),
                // ImageGallery.class);
                // startActivity(intent);
    
                Intent intent = new Intent(
                        Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
                startActivityForResult(intent, REQUEST_CODE);
    
            }
        });