Where are my assets?


I have a quick post today while I work during my holiday. (I don’t want to forget this tip!) If you have an Android app that uses files from the assets folder and you want to inspect whats in the assets folder during runtime use something like the following:

activity.getAssets().list("")

This will get you a list of everything directly under the assets folder bundled with your app. Do NOT do something like this:

activity.getAssets().list("/")

…as this will get you a list of everything bundled outside the assets folder and confuse you. I did this earlier and saw the actual “assets” folder in this list so I thought I could do this:

activity.getAssets().list("assets")

…or this:

activity.getAssets().list("/assets")

Neither which gave me what I wanted. Again, the magic method call is this:

activity.getAssets().list("")

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s