aspose file tools*
The moose likes Android and the fly likes is there a batter way of doing this or a right way of doing it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "is there a batter way of doing this or a right way of doing it?" Watch "is there a batter way of doing this or a right way of doing it?" New topic
Author

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

Anton Sigurdsson
Greenhorn

Joined: Sep 29, 2011
Posts: 13
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

Joined: Jul 26, 2007
Posts: 10451
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there a batter way of doing this or a right way of doing it?