What is the path to your apps “assets” folder in Android?

余生颓废 提交于 2020-01-01 05:29:09

问题


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).

I am using videoView.setVideoPath();

Any help would be greatly appreciated. Thanks


回答1:


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




回答2:


You should put it in /res/raw and access it with

getResources().openRawResource(id)

Find more info here.



来源:https://stackoverflow.com/questions/3448393/what-is-the-path-to-your-apps-assets-folder-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!