Start a new topic

Loading an image from the res/drawable folder

Loading an image from the res/drawable folder

How does a person go about loading an image resource from the res/drawable folder? 

None of these appear to work.

   smallOverlay = new AR.ImageResource(R.drawable.overlay_infone_radar, {onError: errorLoadingImage});
   smallOverlay = new AR.ImageResource(R.drawable.overlay_infone_radar.png, {onError: errorLoadingImage});
   smallOverlay = new AR.ImageResource("R.drawable.overlay_infone_radar.png", {onError: errorLoadingImage});

Thanks for a quick reply,
Steve Saxton
You can reference the files relatively, which is done in the SimpleARBrowser example shipped with the SDK. For android you can therefore put the ARchitect World (.html) in the assets folder together with you image resources.

e.g.
assets/
|- world.html
|- infone_radar.png

You can then use:
smallOverlay = new AR.ImageResource("infone_radar.png", {onError: errorLoadingImage});
to load it.

You don't have access to the R class from your ARchitect World since it is running inside the Web component and does not allow access to native (Java) classes/objects.
Login or Signup to post a comment