How to Create and Access Assets Folder in Android

From WikiHTP

Managing the assets folder in an android project might be the important thing in the some of the projects, If you don't know how to create and access assets folder in android then read on the following steps.

Creating an Assets Folder[edit]

Creating an assets folder is really a simple thing. There are two easy ways to do that.

1. Simply create an empty folder under /YourProject/app/src/main/ and name it as assets.

Create assets 1.jpg

Or

2. Go to File->New->Folder and choose Assets Folder.

Create assets 22.jpg

That's it here you have created an assets folder in your android project.

Accessing an Asset Folder[edit]

To access Assets Folder

AssetManager assetManager = getAssets();
String[] files = assetManager.list("");

To open a certian file:

InputStream input = assetManager.open("filename");

About This Tutorial

This page was last edited on 5 February 2019, at 20:49.