1

I am trying to implement this for so many days. I have read every single post here but I cannot get it done. Everything thas was suggested using methods such as getIntrisicHeight() doesn't seem to work as I want on every screen that I try it. So I am thinking o a solution like this: https://stackoverflow.com/a/4942812/1113997. The problem is that I don't understand many points of that answer:

  1. Can anyone give me an example of the xml file?
  2. What should I check after the return? I mean I will have something like a map and have several areas colored with different colors (in my invisible image,right?) and then if I press the area with the red colour do something, if the green one do something else. Can anyone complete the answer by giving an example of the code?
  3. How do I know that the same red I draw my image on paint for example, will be the same that it will be compared?

Code form the link:

private int getColour(int x, int y) {  
    ImageView img=(ImageView)findViewById(R.id.img2);
    img.setDrawingCacheEnabled(true); 
    Bitmap hotspots=Bitmap.createBitmap(img.getDrawingCache()); 
    img.setDrawingCacheEnabled(false);
    return hotspots.getPixel(x, y);
}
Community
  • 1
  • 1
ghostrider
  • 5,131
  • 14
  • 72
  • 120

1 Answers1

0

Here is a general solution to the image map for Android: http://catchthecows.com/?p=113

I haven't tried it myself, though it appears promising imho

levis501
  • 4,117
  • 23
  • 25