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

2020-06-21 02:11发布

问题:

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.