Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic