可用VideoView源$ C ​​$ C为Android 2.2 [英] Usable VideoView source code for Android 2.2

查看:188
本文介绍了可用VideoView源$ C ​​$ C为Android 2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立我自己的看法显示视频,我想立足于自定义视图中内置Android VideoView。所以我在寻找源$ C ​​$ C至VideoView。我#2中和其他地方最帖子指向的grep code。不幸的是,grep的code中的code似乎没有成为code在案的 developer.android.com 并是不是很实用。
例如,在grep的code中的VideoView.java引用了的 developer.android.com SDK。此外,VideoView调用的MediaPlayer的简历方法,也没有标准的MediaPlayer类可用。
我在哪里可以得到被记录在developer.android.com?

I am building my own view for displaying videos, and I would like to base the custom view on the built-in Android VideoView. I'm therefore looking for the source code to VideoView. Most posts I've found on Stackoverflow and elsewhere point to grepcode. Unfortunately, the code on grepcode doesn't seem to be the code documented on developer.android.com and isn't very usable. For example, the VideoView.java on grepcode references an mContext object which is inherited from View, but not available in the View of the developer.android.com sdk. In addition, the VideoView calls a resume method of MediaPlayer which is also not available in the standard MediaPlayer class. Where can I get the source that is documented on developer.android.com?

谢谢,
万斯

推荐答案

首先,Android的基本框架是开源的,所以从<一个源$ C ​​$ C之间没有差异href=\"http://grep$c$c.com/snapshot/repository.grep$c$c.com/java/ext/com.google.android/android/2.2_r1.1/\"相对=nofollow>的grep code 并从的 github上。他们都有利弊,在grep的code源$ C ​​$ C由API级别标记的,所以易于浏览API类,其中在github上源$ C ​​$ C有完整的更改历史记录每次提交的具体版本,但一个有点复杂查找/检索特定的API类的早期版本。

First of all, Android base framework is open source, there is no difference between the source code from grepcode and the original one from github. They both have pros and cons, source code in grepcode is tagged by API level so easy to navigate specific version of API class, where source code in github have complete change history for every commit, but a bit complex to find/retrieve the early version of specific API class.

上的grep code中的VideoView.java引用这是从View继承了一个mContext对象,但在查看不可用developer.android.com SDK

the VideoView.java on grepcode references an mContext object which is inherited from View, but not available in the View of the developer.android.com sdk

mContext在android.view.View标记为 @hide ,见<一href=\"https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java#L2375\"相对=nofollow>头版本github上。

mContext is marked as @hide in android.view.View, see head version in github.

在VideoView调用的MediaPlayer的简历方法,也没有标准的MediaPlayer类可用。

the VideoView calls a resume method of MediaPlayer which is also not available in the standard MediaPlayer class.

简历()被标记为 @hide 在android.media.MediaPlayer,请参阅早些时候在GitHub上或版本<一个href=\"http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/2.2_r1.1/android/media/MediaPlayer.java#1089\"相对=nofollow>标签2.2_r1.1中的grep code 。

resume() is marked as @hide in android.media.MediaPlayer, see earlier version in github or tag 2.2_r1.1 in grepcode.

一般而言,开发API(的android.jar),谷歌提供消费者开发有 com.android.internal @hide API的剥离。然而,在实际设备上安装运行时API(framework.jar)拥有的一切。

Generally speaking, the development API (android.jar) that google provides to consumer developer has the com.android.internal and @hide APIs stripped off. However, the runtime API (framework.jar) that installed on the actual device has everything.

如果你想在自己的code使用这些内部和隐藏API,解决办法是为使用Java反射或解决方法inazaruk在他的博客中解释的这里

If you want to use these internal and hide API in your own code, the solution is to use either java reflection or the workaround inazaruk explained in his blog here.

希望这是有意义的。

这篇关于可用VideoView源$ C ​​$ C为Android 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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