0

I have an image which include 10 boxes on my image view. When I click the one of boxes I want to change color of box (fill with color). How do I do that? Should I use Surface View or something else?

Update: I found a solution. But if I use AsyncTask the code does not work. If I use a normal class the code works. I do not know why but I think problem is related with invalidate().

Community
  • 1
  • 1
ekremk
  • 253
  • 3
  • 8
  • 18
  • What are those boxes? are they Views? or are they party of your image? – wtsang02 Jun 05 '13 at 13:38
  • My image consist of 10 boxes like chessboard – ekremk Jun 05 '13 at 13:39
  • please provide some code what you tried for it.. or xml what you are using. as you mentioned you have imageview which contains 10 boxes can you provide that? – Mahaveer Muttha Jun 05 '13 at 13:40
  • My image is: http://i43.tinypic.com/330elwm.jpg – ekremk Jun 05 '13 at 13:44
  • And my xml: http://pastie.org/8009984 – ekremk Jun 05 '13 at 13:46
  • I think this is going to be quite complicated, because the boxes are in an image file. You could load it into a Bitmap type and use the canvas to draw or fill the corresponding rectangles. I think it would be more easy to create 2 image files: One for a colored box and one for a white box. Then you can insert the images using a table layout for example and switch between the two image files as necessary. – Chris623 Jun 08 '13 at 11:36
  • @Chris623, if I create colored box for each colors, then there are hundreds of bitmaps. Actually my problem is that: I don't know how I should use invalidate() function in AsyncTask. Because if I use normal class for this operation everything work well. – ekremk Jun 16 '13 at 12:46

0 Answers0