• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anton Sigurdsson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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;
}
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic