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 7872523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:13:24+00:00 2026-06-03T02:13:24+00:00

In my Android app, I load a file and a folder containing a bunch

  • 0

In my Android app, I load a file and a folder containing a bunch of files. I am trying to determine whether these should be added as assets, as resources or something else entirely.

The file is an XML file whose path gets passed to a class constructor that creates an object from what’s contained in the file. I have access to the constructor code if needed.

The folder contains a bunch of specially-formatted non-human-readable files. The path to the folder gets passed to another constructor that knows the structure of the folder and it creates an object. I don’t have access to its code.

Oh, and these two have nothing to do with each other, other than the fact that they are needed by the same app.

So how should I store these? I first thought about adding them as assets but apparently I can only get an input stream for an asset which would not work. If I add the folder as a resource, does it have to go into a specific subfolder under res/? Which one? Does te XML file have to be placed under res/xml? Whether an asset or a resource, is there a default root path that I should use to access the file and the folder?

Thx!

  • 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-03T02:13:26+00:00Added an answer on June 3, 2026 at 2:13 am

    I would put the XML file under res/xml/, simply for performance reasons. res/xml/ supports arbitrary XML, and all XML-encoded resources are parsed about 10 times faster than parsing ordinary files. Your “class constructor that creates an object from what’s contained in the file” would use the XmlResourceParser you get from the Resources object for that XML.

    In terms of the folder, use assets/, as you cannot have a folder structure in resources (raw or otherwise).

    I first thought about adding them as assets but apparently I can only get an input stream for an asset which would not work.

    You don’t really have a choice if you wish to package the files with your app and use them directly. Neither resources nor assets are available as files directly. The only way to get their contents as files is for you to copy them, using streams, to local files yourself, which increases the amount of storage they take up and, in the case of the XML, reduces parsing performance.

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

Sidebar

Related Questions

I am trying to load an XML file from res/raw folder in my Android
In my Android app I should store the data from user in simple text-file,
I am trying to send data from an Android app to a PHP file
I am trying to load an HTML Form stored locally into my android app,
I try to load a .swf file from assets folder to a webview, but
I am working on Android app that should simulate browser request, load reasons. I
I am trying to develop my first Android app through the ADT plugins for
I have to play a video in my android app. The file is stored
I have a problem when I load interactive SWF file in android emulator. I
When I run my app on Android emulator, the app will load a content

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.