Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8805817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:57:46+00:00 2026-06-14T01:57:46+00:00

I’ve been struggling with a simple assets directory listing. I have the following structure

  • 0

I’ve been struggling with a simple assets directory listing. I have the following structure (roughly speaking):

-dirA
--data.xml
--AudioSUBdir
---some files here
--VideoSUBdir
---some files here
-dirB
--data.xml
--AudioSUBdir
---some files here
-test    
--SUBtestDir

All I want is a listing of the parent asset directory (i.e. dirA, dirB, and test; I will then read the data.xml files and on basis of this do something with the content of the subdirs).

I thought that getting the desired two strings would be easy:

try {
   String[] fileNames;
   fileNames = getAssets().list("");
   for(String name:fileNames){
      // process it, e.g. write it out }
} catch (IOException e) {}

However, what I’m getting is something like AudioSUBdir, dirA, dirB, VideoSUBdir, webkit (there ain’t no damned webkit at all!)
It seems to be doing several weird things at the same time:

  • it ignores the directory structure, i.e. reads even subdirectories where it shouldn’t
  • it magically displays a webkit directory although there is none whatsoever in the entire project folder
  • it ignores the “test” directory completely

So my questions are two (and a half)

  1. how do I get just the root folders (I want to later test them for existence of the file folder/data.xml, which will be processed and the application will do whatever it’s supposed to)
  2. any explanation of what is going on. I could theoretically deal with the fact that it even writes out subdirs although I don’t want them. I could even get over the fact that it ignores the test folder (perhaps because they are empty? – Well empty, containing just a subdir, not a file, but anyway…) But where the hell is the webkit folder coming from? Is it somehow “post-generated” by the apk buidling process?
  3. I’m getting a feeling that all subfolders are actually collapsed into one root. Does it mean that files of the same name will collide during the building process?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:57:47+00:00Added an answer on June 14, 2026 at 1:57 am

    As far as the 1st (and major) issue of my question is concerned, I think I’ve figured it out.

    try {
       String[] fileNames;
       fileNames = MyAudioGuideApplication.this.getAssets().list("");
       for(String name:fileNames){
           if (Arrays.asList(getResources().getAssets().list(name)).contains("data.xml"))
            process.the.file.here
       }
    } catch (IOException e) {}
    

    I’m still not sure how exactly getAssets works but at least the following seems to turn out:

    • folders are ignored if they contain no files
    • output is sorted alphabetically regardless the structure
    • when called from the root folder – i.e. …list(“”) – it lists even subdirectories

    Maybe it can help someone struggling as I have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.