tags:

views:

475

answers:

2

InputStream myInput = myContext.getAssets().open("MyFolder/" + "MyFile.db3");

I have a file in the assets folder in a sub folder as above. It doesn't get the file though, is there a special way to specify a sub folder in the assets folder?

Ian

+2  A: 

Edit: was wrong about subfolders.
This code works just fine on 1.5 (for a file sample.txt placed under sub folder in assets):

InputStream is = getAssets().open("sub/sample.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
    Log.e("wtf", line);
}
br.close();

Are you sure you've got the names right?

alex
The docs say you can though.
BahaiResearch.com
A: 

I just test on my Google Legend(SDK 2.1), It works!

lishali