• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor Drawables and getResource()?

user45363

Lurker
Can anyone try to explain to me what 'getResource( )' is?

I have some code running inside my game loop, all I need to do is display images on the canvas/infront of the canvas:

p=new Paint();
Bitmap b=BitmapFactory.decodeResource(getResources(), R.drawable.img1);
p.setColor(Color.RED);
canvas.drawBitmap(b, 0, 0, p);

I've looking into a number of different methods and most use getResource(), what is it and why can it not be resolved in my code? Do I need to import a library or is it referring to another piece of my code?.
 
Back
Top Bottom