java - Why does Activity not have a onClick event handler? -
i'm trying have activity respond single click cannot find way implement this. can use ontouchevent
override method , have logic run there onclick
not possible?
what reason behind , desired effect want?
as requested: have
@override public void onclick(view event) { // todo auto-generated method stub x = event.getx(); y = event.gety(); pixelcolor = color.red; pixelparticle pp = new pixelparticle(this, x, y, 50, 50, pixelcolor); setcontentview(pp); }
this isn't working - implement onclicklistener
, override above method, canvas never draws want draw.
touch down + touch of same point in short time onclick
(actually onclick event in android source code made in way).
because ontouchevent
(in activity) made check touch event of whole screen.but onclick
designed check click event on view(not whole screen).touch event original event,click isn´t.
if want check whether screen clicked ,just use onclick
method of layout(give id mylayout).
linearlayout layout = findviewbyid(r.id.mylayout); layout.setonclicklistener(xxx);
Comments
Post a Comment