Guest User

Untitled

a guest
Mar 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public void takeVideoFromGallery(){
  2. Intent intent = new Intent();
  3. intent.setType("video/*");
  4. intent.setAction(Intent.ACTION_GET_CONTENT);
  5. startActivityForResult(Intent.createChooser(intent,"Select Video"),REQUEST_TAKE_GALLERY_VIDEO);
  6.  
  7. }
  8. public void onActivityResult(int requestCode, int resultCode, Intent data) {
  9. super.onActivityResult(requestCode, resultCode, data);
  10. if (resultCode == this.RESULT_OK) {
  11.  
  12. switch (requestCode) {
  13.  
  14. case REQUEST_TAKE_GALLERY_VIDEO:
  15. if (resultCode == RESULT_OK) {
  16. showVideoGallery(data);
  17. Toast.makeText(this, "Video saved to:n" +data.getData(), Toast.LENGTH_LONG).show();
  18.  
  19. } else if (resultCode == RESULT_CANCELED) {
  20. Toast.makeText(this, "Video recording cancelled.",Toast.LENGTH_LONG).show();
  21. } else {
  22. Toast.makeText(this, "Failed to record video",Toast.LENGTH_LONG).show();
  23. }
  24. break;
  25. }
Add Comment
Please, Sign In to add comment