title: how to access resources in a android library project
body: <p>I am building an android library project which need some static resources(images/xml and etc) internally. </p>
  
  <p>Then I wonder where I can put these resources and how to access them?</p>
  
  <p>Since I put the resources in the <code>assets</code> folder. And I use the AssetManager to access the resources:</p>
  
  <pre><code>public class DataProvider {
      byte[] getDrawableData(int num) {
          AssetManager am = Resources.getSystem().getAssets();
          InputStream is = null;
          try {
              is = am.open("t.jpg");
          } catch (IOException e) {
              return "".getBytes();
          }
          if (is != null) {
              Drawable dw = Drawable.createFromStream(is, null);
              Bitmap bm = ((BitmapDrawable) dw).getBitmap();
              ByteArrayOutputStream stream = new ByteArrayOutputStream();
              bm.compress(Bitmap.CompressFormat.JPEG, 100, stream);
              return stream.toByteArray();
          }
  
          return "".getBytes();
      }
  }
  </code></pre>
  
  <p>However I got the error: <code>W/System.err(19583): java.io.FileNotFoundException: t.jpg</code></p>
  
  <p>What is the problem?</p>
  
  <hr>
  
  <p>As <code>Sankar V</code> said the library project does not support the raw assets. Then It seems that I have to put the resurces under the <code>res</code> folder. </p>
  
  <p>But I have tried to use the <code>Resources.getSystem().getResources()....</code> method which can not get what I want. And people said that this method can only get the system level resources rather than the application level resources.  </p>
  
  <p>If this is the truth. Does it mean that I have to hold a reference of the <code>Context</code> object anywhere I want to get any resources?</p>