Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 653
justinl Avatar asked Aug 10 '10 11:08

justinl


People also ask

What is assets file in Android?

Assets provide a way to include arbitrary files like text, xml, fonts, music, and video in your application. If you try to include these files as "resources", Android will process them into its resource system and you will not be able to get the raw data.

How do I access asset files on Android?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Step 3 – Right click app >> New >> Folder >> Assets folder.

Where are APK assets stored?

Android keeps APK files of installed user apps in /data/app directory and system apps in /system/app directory.

What is asset folder?

It can be noticed that unlike Eclipse ADT (App Development Tools), Android Studio doesn't contain an Assets folder in which we usually use to keep the web files like HTML. Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application.


2 Answers

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

like image 123
Denis Palnitsky Avatar answered Nov 14 '22 22:11

Denis Palnitsky


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

getResources().openRawResource(id)

Find more info here.

like image 30
Key Avatar answered Nov 15 '22 00:11

Key