I have a whole folder structure that I want to copy from my assets folder. However, the mContext.getAssets().open() seems to only want a filename so that it can return an
Could you move the folder to your /raw folder? Then you could use:
com.your.package:raw/yourFile
Like this:
int resourceId = context.getResources().getIdentifier("com.your.package:raw/somefile.txt");
File f = new File(context.getResources().openRawResource(resourceId));
And here's someone doing it with the assets folder:
Android Assets with sub folders
InputStream is = getAssets().open("subfolder/somefile.txt");
Use file:///android_asset
for accessing the asset folder and then you can always give your subfolder there.
AssetManager assetManager = null; // null ??? Get the AssetManager here.
AssetFileDescriptor assetFileDescriptor = null;
try{
assetFileDescriptor = assetManager.openFd("file:///android_asset/yourfolder/file");
FileDescriptor fd = assetFileDescriptor.getFileDescriptor();
} catch (Exception e){}
AssetManager am = con.getAssets();//u have get assets path from this code
InputStream inputStream = null;
inputStream = am.open("file.xml");
or
String file_name="ur.xml"
inputStream = am.open("foldername/"+ur);