小编sil*_*lly的帖子

Android:如何在API15中使用clipRect

我在api 15(Android 4.0.3)上运行自定义视图时遇到问题

代码:

canvas.clipRect(10,10,100,100, Region.Op.DIFFERENCE);
canvas.drawPaint(myPaint);
Run Code Online (Sandbox Code Playgroud)

填充视图的整个区域而不仅仅是差异...它适用于api 8和9 ......

谢谢你的帮助

android canvas

6
推荐指数
1
解决办法
2451
查看次数

将内容 URI 与 ACTION_VIDEO_CAPTURE 结合使用

我目前在我的文件提供程序上使用内容 URI 来检索ACTION_IMAGE_CAPTURE意图返回的相机图像。这工作正常。

出于某种奇怪的原因,尝试从相机检索视频文件时,相同的调用不起作用。

        destinationFile = File.createTempFile("video", ".mp4", this.getFilesDir());
        Uri uri = FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", destinationFile);

        Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        cameraIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
        cameraIntent.setClipData(ClipData.newRawUri(null, uri));
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        startActivityForResult(cameraIntent, ID);
Run Code Online (Sandbox Code Playgroud)

当目的返回时onActivityResult(),destinationFile 为空。

简单地替换MediaStore.ACTION_VIDEO_CAPTUREMediaStore.ACTION_IMAGE_CAPTURE给我预期的行为:所拍摄的图像保存在destinationFile。

这发生在 Nexus 设备和默认的 Google 相机应用程序上的库存 Android 6.0.1 上。

视频捕获真的不支持内容 URI 吗?我宁愿不在可公开访问的目录中使用文件 URI。

camera android video-capture mediastore android-fileprovider

5
推荐指数
1
解决办法
1183
查看次数