Android difference between res and assets

Asked on August 24, 2015
What is difference between res and assets directory in android project structure?

Replied on August 26, 2015
1. res and assets directory both can keep assets like images. In res/drawable, we can keep the images.

2. In assets, we can create our own folder, like image, video, textFile etc and can keep more than one assets accordingly.

3. If we have an image in res/drawable as image3.png, we use id as follows


4. To access image or any other file from assets folder, we need not any asset id, we can do it by AssetManager as follows

InputStream is ="img/image1.png");
Bitmap  bitmap = BitmapFactory.decodeStream(is);

Write Answer

©2024 | Privacy Policy | Contact Us