How to make a part of jpg clickable in android -


image link

as in example image. want use image background , want portion of image building , towers clickable open new activity in app.

you can achieve mapping image , comparing click rect areas mapped image.

after mapped (probably directly on code) have onclicklistener this:

public void onclick(motionevent v){      for(pair<rect,actionlistener> areas : mappedareas)             if(areas.first.contains(v))                    areas.second.onclick(v); } 

ps: have problems absolute values on different screen sizes (if component allows fit_screen) should map relative coordinates (percentage) , convert absolute values before comparing.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -