在哪里SampleZipfileProvider类? [英] Where is the SampleZipfileProvider class?

查看:118
本文介绍了在哪里SampleZipfileProvider类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本节中的文件扩展谷歌的开发指南的底部(<一href="http://developer.android.com/guide/market/expansion-files.html#ZipLib">http://developer.android.com/guide/market/expansion-files.html#ZipLib)有以下文本。

At the bottom of the section in Google's dev guide on expansion files (http://developer.android.com/guide/market/expansion-files.html#ZipLib) there is the following text.

APEZProvider - 大多数应用程序并不需要使用这个类。本   类定义ContentProvider的是从ZIP乘警数据   为了提供文件访问通过内容提供商乌里文件   对于期望乌里访问媒体文件一定的Andr​​oid的API。该   在将APK扩展包提供的示例应用程序演示   一个场景,这个类可用于指定与视频   VideoView.setVideoURI()。查看示例应用程序的类   SampleZipfileProvider对于如何此类扩展到一个实例   在应用中使用。

APEZProvider - Most applications don't need to use this class. This class defines a ContentProvider that marshals the data from the ZIP files through a content provider Uri in order to provide file access for certain Android APIs that expect Uri access to media files. The sample application available in the Apk Expansion package demonstrates a scenario in which this class is useful to specify a video with VideoView.setVideoURI(). See the sample app's class SampleZipfileProvider for an example of how to extend this class to use in your application.

在讨论的示例应用程序不包含这个类。但它确实包含引用在AndroidManifest.xml一个.SampleVideoPlayerActivity文件,这是不是present项目无论是。

The sample application in question doesn't contain this class. But it does contain a reference to a .SampleVideoPlayerActivity file in the AndroidManifest.xml, which is not present in the project either.

有没有人试图实现基于 APEZProvider 的具体类和用它 VideoView.setVideoURI()

Has anyone tried to implement a concrete class based on the APEZProvider and used it with VideoView.setVideoURI()?

我已经实现了类:

public class ZipFileContentProvider extends APEZProvider {

    @Override
    public String getAuthority() {
        return "com.myCompany.myAppName.provider.ZipFileContentProvider";
    }
}

但我不知道如何使用它与 VideoView.setVideoURI()通话。任何人都可以帮忙吗?

But I don't know how to use it with the VideoView.setVideoURI() call. Can anyone help?

推荐答案

原来,我的ZipFileContentProvider就足够了。对于那些过这个问题来了。以下是我做过使用的内容提供者VideoView.setVideoURI()方法。

It turned out that my ZipFileContentProvider was sufficient. For those coming across this problem. Here is what I did to use the content provider for the VideoView.setVideoURI() method.

添加提供商的体现。

<provider android:authorities="com.myCompany.myAppName.provider.ZipFileContentProvider" android:name=".ZipFileContentProvider"></provider>

在视频播放器类:

final String AUTHORITY = "com.myCompany.myAppName.provider.ZipFileContentProvider";
final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
video = (VideoView) findViewById(R.id.video);
video.setVideoURI(Uri.parse(CONTENT_URI + "/" + videoFileName + ".mp4"));

这篇关于在哪里SampleZipfileProvider类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆