mohamad ali gharat
mohamad ali gharat

Reputation: 501

android - how to select a video File using intent and getting video of it

Im choosing the video by this code:

 Intent galleryIntent = new Intent(Intent.ACTION_PICK,
            MediaStore.Video.Media.EXTERNAL_CONTENT_URI);

    startActivityForResult(galleryIntent, 1);

but i dont know how to handle the result in this method:

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

        // When an Image is picked
        if (requestCode == 1 && resultCode == RESULT_OK
                && null != data) {??????????????????????????????????}

can any one help me for decoding the video , i need to show it in a VideoView. thanks

Upvotes: 0

Views: 885

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007584

i need to show it in a VideoView

Call data.getData() to get the Uri of the picked video. Then, pass that Uri to setVideoURI() on the VideoView.

Upvotes: 1

Related Questions