4

I want to create new XML resource IDs at runtime. Just generic XML resources like in the res/xml folder, but from a file on an SD card or anywhere in the filesystem.

I found this solution that says it's possible: How do I generate XML resources at runtime on Android?.

It says to:

  1. Save XML into another external folder (SD card or so)

  2. Create AssetManager over those file(s)

  3. Then create Resources which can be later used as ordinary Android resource stored in APK

I don't understand step 2 since there is no constructor for AssetManager. How do I create an AssetManager for external files?

Thanks in advance,

Barry

Community
  • 1
  • 1
Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135

1 Answers1

0

By create, I think they mean get the AssetManager:

    Context.getAssets()

Then, use the asset manager to open the XML file:

    AssetManager.openXmlResourceParser(String fileName)
Karim Varela
  • 7,562
  • 10
  • 53
  • 78