Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Raw folders - creation and reference

I'm trying to create a raw folder for my android app which will hold different media files for use later. But I can't seem to be able to reference the created raw folder in my .java classes.

For example: R.? -> This returns a list of all possible resources I can use like the basic drawable, layout and values folder. However it won't display the raw folder.

Is it correct to say that raw is created as a general folder and nothing else? Or does it have to be declared in the AndroidManifest.xml file in order to be recognised as a resource?

like image 620
Katana24 Avatar asked Apr 25 '11 10:04

Katana24


People also ask

What is raw folder in Android?

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.

What is Android Assets folder?

Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application. If one tries to add these files as “resources“, Android will treat them into its resource system and you will be unable to get the raw data.


2 Answers

The raw folder must be inside the res folder, otherwise it won't work.

like image 162
Leandroid Avatar answered Oct 14 '22 07:10

Leandroid


Right click on package click on new on popup then click on android resource directory a new window will be appear change the resource type to raw copy and past song to raw folder remember don't drag and drop song file to raw folder and song spell should be in lower case This method is for Android Studio Link enter image description here

like image 21
Misbah Farooqi Avatar answered Oct 14 '22 07:10

Misbah Farooqi