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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -