0

I am selecting image and videos from gallery using intent.here is the code:

Intent galleryIntent = new Intent(Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            galleryIntent.setType("image/* video/*");
            startActivityForResult(galleryIntent,RESULT_LOAD_IMG);

onActivityResult method:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        try {

            if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) {
                Uri selectedImage = data.getData();
//                VideoView videoView = (VideoView) findViewById(R.id.vidView);
//                videoView.setVideoURI(selectedImage);
//                videoView.start();

            } else {
                Toast.makeText(this, "You haven't picked Image",
                        Toast.LENGTH_LONG).show();
            }
        } catch (Exception e) {
            Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)
                    .show();
        }

    }

My question is how can I save this selected picture or video in internal storage and then play from SD card? I tried Google, but was unable to find anything. Kindly help.

JorgeAmVF
  • 1,660
  • 3
  • 21
  • 32
  • See [This](https://stackoverflow.com/questions/6674249/how-to-save-file-to-sd-card) thread – ADM Nov 04 '17 at 18:34
  • Why would you save the selected picture to internal storage? It is already a file in internal strorage as otherwise the Gallery app would not show it. And further i wonder that you think something can be played from sd card if you saved it to internal memory. Makes no sense. – greenapps Nov 04 '17 at 22:22

0 Answers0