• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is there a batter way of doing this or a right way of doing it?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry for bed English.

I got the Event Touch thingy runing. bat my code is not rally good.
is there a batter way of doing this or a right way of doing it?
I'm making a invisible box where i can press the screen, its like a button.

the code is working i thing. when i touch the screen where the y and x i do get respond.
i made the program exit, and then open a other window.

note: I me by using the code in a wrong way. I was having a hard time understanding java in general. im using MotionEvent is that okkay for this?

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub

x = event.getX();
y = event.getY();

switch(event.getAction()){
case MotionEvent.ACTION_DOWN:

break;
case MotionEvent.ACTION_UP:
if(y > 50 && y < 100 && x > 50 && x < 100){

}
break;
}
return true;
}
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not really sure what problem you are facing. But for handling touch events on Android, I would recommend going through
http://www.vogella.com/articles/AndroidTouch/article.html
reply
    Bookmark Topic Watch Topic
  • New Topic