Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raw folder url path?

Tags:

android

How can I get the URL of the raw folder? I do not want to access my asset via id but by path instead.

like image 420
panthro Avatar asked Nov 01 '11 12:11

panthro


People also ask

What is a raw folder?

The raw (res/raw) folder is one of the most important folders and it plays a very important role during the development of android projects in android studio. The raw folder in Android is used to keep mp3, mp4, sfb files, etc. The raw folder is created inside the res folder: main/res/raw.

How do I play a raw video folder?

Create raw folder under res folder. It must be in a supported format (3gp, wmv, mp4 ) and named with lower case, numerics, underscores and dots in its filename likewise:video_file. mp4. VideoView view = (VideoView)findViewById(R.


2 Answers

Uri video = Uri.parse("android.resource://com.cpt.sample/raw/filename"); 

Using this you can access the file in raw folder, if you want to access the file in asset folder use this URL...

file:///android_asset/filename 

Make sure you don't add the extension to the filename. E.g. "/movie" not "/movie.mp4".

like image 51
Karthi Avatar answered Oct 02 '22 17:10

Karthi


This is to find a file named video.mp4 inside raw folder:

    String path = "android.resource://" + getPackageName() + "/" + R.raw.video; 
like image 31
Mario Velasco Avatar answered Oct 02 '22 15:10

Mario Velasco