What I want is the same with Images. When the user clicks on a button (in my case the VideoView itself) I want to let them open the Gallery and load a video into the VideoView.
vv_video = (VideoView) findViewById(R.id.vv_video);
vv_video.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Complete action using"), LOAD_VIDEO);
return false;
}
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) return;
switch (requestCode) {
case LOAD_VIDEO:
Toast.makeText(NewBucketActivity.this, "test", Toast.LENGTH_SHORT).show(); //this appears!
Bundle video = data.getExtras();
mVideoCaptureUri = video.getParcelable("data");
vv_video.setVideoURI(mVideoCaptureUri);
break;
}
}
But nothing happens when I select the video in the Gallery. The Toast msg appears so I messed sg up with the Bundle or the Uri. It should be displayed in the VideoView, right?