Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get access to raw resources that I put in res folder?

In J2ME, I've do this like that: getClass().getResourceAsStream("/raw_resources.dat");

But in android, I always get null on this, why?

like image 759
Arkaha Avatar asked May 18 '10 10:05

Arkaha


People also ask

What is kept in res 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.

Which of the following are available inside res folder?

As you can see in this example, the res/ directory contains all the resources (in subdirectories): an image resource, two layout resources, mipmap/ directories for launcher icons, and a string resource file.


1 Answers

For raw files, you should consider creating a raw folder inside res directory and then call getResources().openRawResource(resourceName) from your activity.

like image 125
Samuh Avatar answered Sep 30 '22 18:09

Samuh