0

I'm writing a app for a tablet. I have a activity that contains text and buttons and an area where I want to put something that is drawn on a canvas. When buttons are pressed I want to draw a grid that will contain lines, text and images, built dynamically.

What I can't figure out is after I draw this on the canvas how to put/embed the canvas into the activity in a certain area(ImageView?). I have a prototype app where I can draw the grid, but I can't figure out how to put the canvas into the activity.

Any help or point me to an article would be really appreciated. Thanks

1 Answers1

0

First you get a bitmap from your canvas then you can use it in your ImageView via ImageView.setImageBitmap(mCanvasBitmap)

Community
  • 1
  • 1
MrEngineer13
  • 38,642
  • 13
  • 74
  • 93
  • Update - MrEngineer ... thanks for your help. I can draw my lines and text on the canvas, put it into theImageView and see it on the screen. If I try to include an image on the canvas that is the only thing that will display, all lines and text are gone. If the image(s) aren't added the grid shows as excpected. This is how I'm adding an image. myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon4); my icons/images 20x20 png files. – user3566673 Jul 24 '14 at 15:50
  • try adding the image you want to display as the background via setBackground() and the bitmap via setImageBitmap() – MrEngineer13 Jul 24 '14 at 16:21