You need to set the bounds of the drawable first. On Tue, May 26, 2009 at 9:35 AM, Jay <pathomp...@gmail.com> wrote: > > I want to load an icon from resource and draw over it. But I cannot > get it into a canvas. Can anyone please help me with the code below. > If I uncomment c.drawColor(), I get blue color as expected. So the > problem is on icon.draw(). > > Drawable icon = getResources().getDrawable(R.drawable.icon2); > Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), > icon.getIntrinsicHeight(), > Bitmap.Config.ARGB_8888); > Canvas c = new Canvas(bitmap); > icon.draw(c); > //c.drawColor(Color.BLUE); > > ImageView iv = (ImageView)findViewById(R.id.icon); > iv.setImageBitmap(bitmap); > > > Thanks, > Jay > > >
-- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---