• Intent 获取视频,音频等


    //选择图片 requestCode 返回的标识 

               Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); //"android.intent.action.GET_CONTENT" 

                innerIntent.setType(contentType);    //查看类型 String IMAGE_UNSPECIFIED = "image/*"; 详细的类型在 com.google.android.mms.ContentType 中 

                Intent wrapperIntent = Intent.createChooser(innerIntent, null); 

                ((Activity) context).startActivityForResult(wrapperIntent, requestCode); 

              //视频 
               Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); 

                innerIntent.setType(contentType);    //String VIDEO_UNSPECIFIED = "video/*"; 

                Intent wrapperIntent = Intent.createChooser(innerIntent, null); 

                ((Activity) context).startActivityForResult(wrapperIntent, requestCode); 
            //添加音频 
              Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); 
                innerIntent.setType(contentType); //String VIDEO_UNSPECIFIED = "video/*"; 
                Intent wrapperIntent = Intent.createChooser(innerIntent, null); 
                ((Activity) context).startActivityForResult(wrapperIntent, requestCode); 
           //录音 
              Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
                intent.setType(ContentType.AUDIO_AMR); //String AUDIO_AMR         = "audio/amr"; 
                intent.setClassName("com.android.soundrecorder", 
                        "com.android.soundrecorder.SoundRecorder"); 
                ((Activity) context).startActivityForResult(intent, requestCode); 

    //幻灯片头大 不做详细 


         //拍摄视频 
          int durationLimit = getVideoCaptureDurationLimit();   //SystemProperties.getInt("ro.media.enc.lprof.duration", 60); 
           Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); 
           intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); 
                                    intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, sizeLimit); 
                                    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, durationLimit); 
                                    startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO); 


           //拍照 REQUEST_CODE_TAKE_PICTURE 为返回的标识 
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);               //"android.media.action.IMAGE_CAPTURE"; 
            intent.putExtra(MediaStore.EXTRA_OUTPUT, Mms.ScrapSpace.CONTENT_URI);     // output,Uri.parse("content://mms/scrapSpace"); 
            startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE);
  • 相关阅读:
    2-2. 然后是几点(15)
    2-1. 厘米换算英尺英寸(15)
    2-0. 整数四则运算(10)
    忙碌的下半学期
    ACM 第十九天
    ACM 第十八天
    ACM 第十七天
    凸包模板
    极角排序常用方法
    ACM 第十六天
  • 原文地址:https://www.cnblogs.com/pandans/p/2098152.html
Copyright © 2020-2023  润新知