Android Question Access to #AdditionalRes from app code

Discussion in 'Android Questions' started by jotaele, Jun 16, 2015.

  1. jotaele

    jotaele Member Licensed User

    Hi:

    I have a folder in the main folder of the app that is used for a library, included in the app with the clause:

    Code:
    #AdditionalRes: ..\Resources
    If I want to access the files included in the #AdditionalRes folder from code, how can I do it?

    I tried a lot of commands using a File Object but I cannot do it, and I dont want to replicate resources.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use XmlLayoutBuilder library to access the resources.
     
  3. jotaele

    jotaele Member Licensed User

    Last edited: Jun 17, 2015
  4. jotaele

    jotaele Member Licensed User

    I tried but didn't work for me.

    The folder of the images is [Main Folder]/Resources/drawable/

    Inside this folder there is a lot of images.

    I tried to get one with this code, but not work.

    Code:
    #AdditionalRes: ..\Resources

    Dim z As XmlLayoutBuilder
    z.GetDrawable(
    "a.png")

    OR

    Dim z As XmlLayoutBuilder
    z.GetDrawable(
    "drawable/a.png")

    OR

    Dim z As XmlLayoutBuilder
    z.GetDrawable(
    "Resources/drawable/a.png")

    OR

    Dim z As XmlLayoutBuilder
    z.GetDrawable(
    "../Resources/drawable/a.png")
    What it the correct path?
     
  5. warwound

    warwound Expert Licensed User

    Remove the .png file extension and try again.
     
    Erel and thedesolatesoul like this.
  6. jotaele

    jotaele Member Licensed User

    Easy. Lots of thanks.
     
Loading...