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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -