Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>@Peter Knego (not enough reputation to annotate the answer directly - stupid SO)</p> <p>My (limited) understanding of the asset manager is that it allows access to files in the <code>foo/assets</code> dir. So the code from Peter would access:</p> <p><code>foo/assets/drawable/myimage.png</code></p> <p>I think @karse23 wants to know whether he can access images in the <code>res/drawable</code> dir:</p> <p><code>foo/res/drawable/myimage.png</code></p> <p>Why would you want to do this? Well if you want to access resources from an app <em>and</em> also 3rd-party apps. Ideally you do it using R from the app which owns the resource (so you can whack that ids in the layouts) and by name in the 3rd-party app (where you don't have access to the R class). </p> <p>I'm trying to do just this and Peter's approach is referencing the assets dir in my code (but then again I'm accessing the assets in another package). (you can check this by logging the strings returned by the <code>assetManager.list("")</code>). </p> <p>In support of Peter the doc says:</p> <pre><code>public final AssetManager getAssets () Retrieve underlying AssetManager storage for these resources. </code></pre> <p>which does seem to support the behaviour Peter is suggesting (maybe a bug in the old Android I'm using???).</p> <p>In conclusion I think the solution is to whack the files in the assets dir and access them in the parent app from code :( (or do it the way the android dudes intended using a ContentProvider).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload