How to access files under assets folder of other apk's?

AndroidDev picture AndroidDev · Sep 12, 2012 · Viewed 48.9k times · Source

When we browse any apk we found there is one folder named assets. Now I want to access that folder programatically. so how should I proceed for that? (Input for the program will be apk file/just app name).

Answer

Nermeen picture Nermeen · Sep 12, 2012

This will list all the files in the assets folder:

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

This to open a certian file:

InputStream input = assetManager.open(assetName);