Android - Is it possible to have dynamically moving clickable objects in a view -



Android - Is it possible to have dynamically moving clickable objects in a view -

for purposes of game development, possible set view , create class extends button or implements clickable or something. im trying figure out best way handle screen clicks on moving objects onscreen , right im drawing in canvas inturn drawn view cant create individual bitmaps representing objects clickable.

so before throw out lot of work , seek know if possible have dynamically moving objects within view can independently handle screen clicks.

add ontouchlistener view (the 1 that draws objects on canvas), , in ontouch(view v, motionevent event), coordinates of event:

int x = event.getx(); int y = event.gety();

then loop through objects draw , see if these coordinates on objects current area, if so, know has been clicked.

android view extend

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -