Touch and Click Events

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Touch and Click Events

Postby aspekt9 » Tue Feb 24, 2009 5:15 am

I'm trying to get the amount of time a user is pressing and holding a view for. What's the easiest way to go about doing this?
aspekt9
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Feb 24, 2009 5:13 am

Top

Postby MrSnowflake » Tue Feb 24, 2009 12:25 pm

onKeyDown() {
timeStart = currentTimeMillis();
}
onKeyUp() {
timeTaken = currentTimeMillis() - timeStart;
}

Something like this will also work for touch events.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby abraxas » Wed Feb 25, 2009 1:50 am

I would use the getDownTime () method provided by MotionEvent.
abraxas
Junior Developer
Junior Developer
 
Posts: 20
Joined: Fri Feb 06, 2009 12:33 pm

Postby kali » Thu Feb 26, 2009 5:58 am

hai friends,
i want to date current date such as system date in sql
how can i do it in android??
kali
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Tue Jan 27, 2009 1:31 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests