Here is a generic solution for handling any number of arbitrary shaped
hotspots:
1) create additional bitmap (same size as what you plan to show on the
screen) and draw "hot areas" with a specific color. If you have less
than 255 hotspots then use 8bpp bitmap with background of color with
index 0. Draw the first hot spot with desired shape and color it with
index 1, then the second area - with index 2 and so on. Or you can do
it with 24bpp bitmap but assign each area a specific RGB combination.
2) load this bitmap (let's call it "control") when your application
starts up.
3) on screen click: convert screen coordinates into x,y from the
origin of your image (which can be larger than the screen)
4) get pixel color from the control bitmap - if it is > 0 then it is a
hotspot index of code.
Good luck
Igor

On Dec 5, 5:43 am, bagelboy <[email protected]> wrote:
> I have an image and I want to make parts of it clickable. From my
> research I can see 2 ways to do this:
> 1) I could chop the image into pieces and put them into a relative
> layout
> 2) I could create a matrix of points that describe the clickable areas
> and use onTouch events to track clicks
>
> Option 1 has the drawback where you have to make areas square or
> rectangular, plus alignment and scaling are a pain.
>
> Option 2 can be scaled easier however I'm not sure how to go about
> coding it.
>
> Am I missing any possibilities? Are there any tools or source code
> that would make it easier?
>
> -BB

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to