什么是路径,您的应用程序和QUOT;资产"文件夹中的Andr​​oid?您的、应用程序、路径、资产

2023-09-05 08:34:40 作者:焦糖玛琦朵~

我开发一个Android应用程序,并希望有.apk文件里面捆绑的视频文件(MP4),这样,当应用程序被启动,我可以打一个简短介绍视频。

I am developing an Android App and would like to have a video file (mp4) bundled inside the .apk so that when the app is launched I can play a short intro video.

不幸的是我在遇到麻烦搞清楚在我的项目文件夹我应该把这个视频文件,以及如何访问它(文件路径)。

Unfortunately I'm having trouble figuring out where in my project folder I should place this video file, and also how to access it (the path to the file).

我使用 videoView.setVideoPath();

任何帮助将是很大的AP preciated。谢谢

Any help would be greatly appreciated. Thanks

推荐答案

放入水库\原始文件夹中。然后,在code使用URI:android.resource://com.mypackagename/raw/myvideosample

Put it in res\raw folder. Then in code use this uri: "android.resource://com.mypackagename/raw/myvideosample"