Android: are coordinate hardcore value's responsive? -


enter image description here have 3 different type image. when click each section it's going different rooms. tried use https://github.com/lukle/clickableareasimages, https://github.com/catchthecows/androidimagemap these libraries. reason it's not worked.(maybe can't run it)

and when runned (not worked thought) 1 idea:

clickableareas.add(new clickablearea(500, 200, 125, 200, new character("homer", "simpson")));             clickableareas.add(new clickablearea(600, 440, 130, 160, new character("bart", "simpson"))); 

my idea: when click image in real device x, y coordination. , when x, y coordination writed following:

imageview.setontouchlistener(new view.ontouchlistener() {             @override             public boolean ontouch(view view, motionevent motionevent) {                  float x = motionevent.getx();                 float y = motionevent.gety();                    if(motionevent.getaction() == motionevent.action_down) {                     if(x >= 78 && y >= 84){                         if(x <= 343 && y <=220){                             toast.maketext(getactivity(), "80.1 a", toast.length_short).show();                         }                     }                      if(x >= 942 && y >= 84){                         if(x <= 1212 && y <=220){                             toast.maketext(getactivity(), "80.1 b", toast.length_short).show();                         }                     } //                    toast.maketext(getactivity(), "x " + x + "\n y " + y, toast.length_short).show();                  }                 return false;             }         }); 

it's worked great in device. how become responsive? when run other device x , y change?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -