9 messages in com.googlegroups.android-developersRe: Incoherent Documentation for Asse...
FromSent OnAttachments
Rui1...@gmail.com25 Feb 2008 07:01 
Rui1...@gmail.com25 Feb 2008 09:37 
Rui1...@gmail.com25 Feb 2008 09:51 
Rui Martins25 Feb 2008 21:40 
hackbod26 Feb 2008 00:00 
Rui Martins26 Feb 2008 07:43 
hackbod26 Feb 2008 09:41 
straz28 Feb 2008 20:41 
straz28 Feb 2008 20:48 
Subject:Re: Incoherent Documentation for Asset Manager
From:straz (ost@gmail.com)
Date:02/28/2008 08:41:11 PM
List:com.googlegroups.android-developers

I'm using a Mac, not Windows, and I have similar problems. My assets are not appearing at all in the listings.

In my project, my "assets" dir is at the same level as res, src, and AndroidManifest.xml.

Bug 1: I've tried putting my file in "assets/myfile.png" as well as "assets/subdir/myfile.png". It's not visible to mgr.list(""), mgr.list("/"), mgr.list("assets"), nor mgr.list("/assets").

Bug 2: The strings returned by mgr.list(path) which describe directories do not contain "/", contrary to the specification.

Using a revised version of the above code posted by Rui:

void displayFiles (AssetManager mgr, String path) { try { String list[] = mgr.list(path); if (list != null) for (int i=0; i<list.length; ++i) { Log.v("Assets:", path +"/"+ list[i]); displayFiles(mgr, path + list[i]); } } catch (IOException e) { Log.v("List error:", "can't list" + path); } }

AssetManager mgr = new AssetManager(); displayFiles(mgr, "/");

prints:

V/Assets: (13257): //AndroidManifest.xml V/Assets: (13257): //META-INF V/Assets: (13257): //assets V/Assets: (13257): //res V/Assets: (13257): //resources.arsc

displayFiles(mgr, "");

prints:

displayFiles(mgr, "");

prints:

V/Assets: (14399): /images V/Assets: (14399): images/corky.png V/Assets: (14399): images/cylon_dot.png V/Assets: (14399): images/cylon_left.png V/Assets: (14399): images/cylon_right.png V/Assets: (14399): images/violet.png V/Assets: (14399): /skins V/Assets: (14399): skins/contact-andy-rubin.png V/Assets: (14399): skins/contact-larry-page.png V/Assets: (14399): /sounds V/Assets: (14399): sounds/bootanim0.raw V/Assets: (14399): sounds/bootanim1.raw V/Assets: (14399): /webkit V/Assets: (14399): webkit/missingImage.png V/Assets: (14399): webkit/nullplugin.png V/Assets: (14399): webkit/textAreaResizeCorner.png