How to create correctly the "raw" folder(/res/raw) in order to play audio file puted in it

When I create a new project the "raw" folder does not appear automaticaly and I have to do it manually. The problem is that after creation of this folder and when I already copied the audio file in it I can't define it, as it's happens in tutorials, using R.raw.audio.mp3(also in R.java there is no declaration about raw folder). The line of code with error is MediaPlayer playMyMusic = new MediaPlayer().create(MainActivity.this, R.raw.Song); and the error apears at raw (error: "raw cannot be resolved or is not a field") Must to note that I'm new in android development and sorry for bad English.

Answers


Right click on "res" folder New Directory, name "raw"


Need Your Help

Adding node to existing xml element

c# xml nullreferenceexception

I'm getting this error when trying to append a node to existing element in my xml document.The error is: Object reference not set to an instance of an object.

How to add a "More" and "Less" text indicator in a expandable UILabel?

ios swift uilabel

I am a IOS learner. I was doing a sample project, in which i require "More" and "Less" text indicators in a UILabel for which i have added a SingleTapGestureRecognizer to expand and contract based ...