how to get the pic from my res?

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

how to get the pic from my res?

Postby rjuy » Mon Nov 15, 2010 2:57 am


Currently per default, I have 3 drawables in my project folder namely: drawable-hdpi,drawable-ldpi,drawable-mdpi. Each folder has a image icon.png...

NOw I want to show the image on the screen, see codes below

Code: Select all
   protected void onDraw(Canvas canvas) {
      Paint background = new Paint();


The code above generates an error; "Link all references for a local rename (does not
change references in other files)"

what does this mean?

Please help!!!!

thanks a lot

Experienced Developer
Experienced Developer
Posts: 52
Joined: Mon Oct 25, 2010 2:38 am


Re: how to get the pic from my res?

Postby L337CodeMonkey » Sun Nov 21, 2010 7:47 am

I've been trying to do something similar... (well, in my case, I am trying to get an image to display at all, not just as a background) Look forward to seeing any answers here.
Posts: 2
Joined: Sun Nov 21, 2010 7:41 am

Re: how to get the pic from my res?

Postby vpachawa » Tue Dec 21, 2010 11:53 pm

This works for me:

canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.icon), X, Y, null);

Try this.
Venkata Pachawa
Posts: 47
Joined: Tue Jun 08, 2010 8:54 pm
Location: St Catharines, Ontario, Canada


Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests