Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void takeVideoFromGallery(){
- Intent intent = new Intent();
- intent.setType("video/*");
- intent.setAction(Intent.ACTION_GET_CONTENT);
- startActivityForResult(Intent.createChooser(intent,"Select Video"),REQUEST_TAKE_GALLERY_VIDEO);
- }
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode == this.RESULT_OK) {
- switch (requestCode) {
- case REQUEST_TAKE_GALLERY_VIDEO:
- if (resultCode == RESULT_OK) {
- showVideoGallery(data);
- Toast.makeText(this, "Video saved to:n" +data.getData(), Toast.LENGTH_LONG).show();
- } else if (resultCode == RESULT_CANCELED) {
- Toast.makeText(this, "Video recording cancelled.",Toast.LENGTH_LONG).show();
- } else {
- Toast.makeText(this, "Failed to record video",Toast.LENGTH_LONG).show();
- }
- break;
- }
Add Comment
Please, Sign In to add comment