For my app, I was looking for implementation where you keep the button pressed and it continuously keeps updating the value in chunks. Sadly, View.OnLongClickListener doesn't have any such support, so I decided to make a custom listener for this behaviour. You can view the final implementation here -
Some notes on the implementation of this listener -
- To support continuous long click listener, I am attaching 2 listeners to the view object. View.OnLongClickListener and View.OnTouchListener
- View.OnLongClickListener kicks in when it first detects a long click by user. After executing the default behaviour, it adds a delayed message to a Handler to execute the same code. This way, after a stipulated time the same code kicks in and increments the value again and thus simulating the required behaviour for continuous long click.
- View.OnTouchListener is used to detect a MotionEvent.ACTION_UP event, where the user disengages from the screen. On detecting it, any pending messages in the Handler are cleared thus finishing the event.
- As an add-on, I stimulate a haptic feedback every time the code is run to give user feedback about the long click action being kicked in.
The code for the above sample can be found on github here -> https://github.com/anagri/AndroidLearnings
The gist of listener implementation is below ->
thankyou so much :)
ReplyDeleteYou're such a genius! Thanks!
ReplyDeleteThis is very helpful!
ReplyDeleteyou're the best
ReplyDelete:D
Appreciating the persistence you put into your blog and detailed
ReplyDeleteinformation you provide.
Android Training in Chennai
Android Training in Bangalore
Needed to compose one little word yet thanks for the suggestions that you are contributed here.
ReplyDeleteBest Online Software Training Institute | Android Training
This was very useful indeed. Thank you!
ReplyDeleteThis blog very useful for me to learn and understand easily.Keep sharing like this.
ReplyDeleteSelenium Training in Chennai
Software Testing Training in Chennai
but when longpress deactivated then to still count is incrementing...
ReplyDeleteNice blog!! I hope you will post more articles like this!!
ReplyDeleteSelenium Training in Chennai
Selenium Course in Chennai
Big Data Training in Chennai
German Language Classes in Chennai
Selenium Training in Velachery
Selenium Training in Porur
Selenium Training in Adyar
Thank you so much for posting this. I really appreciate your work. Keep it up. Great work!Best Placement company in Hyderabad
ReplyDeleteGood..
ReplyDeletebitwise aptitude questions
how to hack flipkart legally
zenq interview questions
count ways to n'th stair(order does not matter)
zeus learning subjective test
ajax success redirect to another page with data
l&t type 2 coordination chart
html rollover image
hack android phone using cmd
how to hack internet speed upto 100mbps
Nice..
ReplyDeleteinternships in chennai
winter internship mechanical engineering
internship for aeronautical engineering students in india 2019
kaashiv
list of architectural firms in chennai for internship
paid internships in pune for computer science students
diploma final year project topics for information technology
internship
data science internship report
inplant training
good post...
ReplyDeleteinternship report on python
free internship in chennai for ece students
free internship for bca
internship for computer science engineering students in india
internships in hyderabad for cse students 2018
electrical companies in hyderabad for internship
internships in chennai for cse students 2019
internships for ece students
inplant training in tcs chennai
internship at chennai
very nice post.........
ReplyDeleter programming training in chennai
internship in bangalore for ece students
inplant training for mechanical engineering students
summer internships in hyderabad for cse students 2019
final year project ideas for information technology
bba internship certificate
internship in bangalore for ece
internship for cse students in hyderabad
summer training for ece students after second year
robotics courses in chennai
Nice Infromation....
ReplyDeleteinternship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in hyderabad
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate
it is good blogs!!!
ReplyDeletepaid internships in pune for computer science students
machine learning training in chennai
data science internship in chennai
dot net training in chennai
kaashiv infotech chennai
internship for aeronautical engineering students in india
internship in automobile industry
big data internship in chennai
machine learning internship in chennai
internship in chennai for it students
excellent......
ReplyDeletehttps://www.wikitechy.com/resume/apache-solr-resume-sample/
https://www.wikitechy.com/resume/apache-spark-sample-resume/
https://www.wikitechy.com/resume/application-developer-resume-samples/
https://www.wikitechy.com/resume/application-support-engineer-resume-sample/
https://www.wikitechy.com/resume/asp-dot-net-mvc-developer-resume/
https://www.wikitechy.com/resume/asp-net-core-developer-resume/
https://www.wikitechy.com/resume/asp-net-developer-resume-samples/
https://www.wikitechy.com/resume/assistant-accountant-cv-sample/
https://www.wikitechy.com/resume/assistant-accountant-resume/
https://www.wikitechy.com/resume/assistant-accountant-resume-sample/
branch-operations-manager-resume-samples
ReplyDeletebusiness-executive-resume-samples
business-owner-resume-samples
business-to-business-sales-resume-sample-sales-resumes
cad-design-engineer-resume-samples
call-centre-jobs-resume-sample
ca-resume-samples-chartered-accountant-resume-format
cassandra-database-administrator-resume
category/accountant-resume
category/admin-resume
nice....
ReplyDeletecategory/advocate-resume
category/agriculture-forestry-fishing
category/android-developer-resume
category/assistant-professor-resume
category/chartered-accountant-resume
category/database-resume
category/design-engineer-resume
category/developer-resume
category/engineer-resume
category/entrepreneur-and-financial-services-resume
good ....nice...
ReplyDeleteresume/category/software-testing-resume
resume/category/sslc-resume
resume/category/storekeeper-resume
resume/category/stylist-resume
resume/category/teachers-resume
resume/category/technical-architect-resume
resume/category/web-developer-resume
cics-system-programmer-resume-example
resume/cisco-network-engineer-resume
resume/cisco-network-engineer-resume-sample
good.....nice..
ReplyDeletecategory/maintenance-resume
category/manager-resume
category/mechanical-engineering-resume
category/network-engineer-resume
category/officer-resume
category/operations-resume
category/process-associate-resume
category/quality-control-resumes
category/software-engineer-resume
good... nice... very useful..
ReplyDeleteassistant-director-resume-format
director-resume-sample
assistant-professor-resume-sample
back-office-executive-resume-samples
bank-branch-manager-resume-samples
basketball-coach-resume-sample-coach-resumes
bca-fresher-resume-sample
best-general-manager-resume-example
bpo-resume-freshers-sample
bpo-resume-samples-for-freshers
it is best blogs ....
ReplyDeletecivil-engineer-resume-format
client-service-executive-resume-sample
cognos-developer-resume-samples
college-lecturer-resume
college-lecturer-resume-sample
commercial-assistant-resume-sample
compliance-officer-resume-samples
computer-teacher-resume-format
computer-teacher-resume-sample
cordova-developer-resume-sample
ReplyDeletefilm-director-resume
finance-and-accounting-manager-resume-samples
finance-director-resume-examples
fire-safety-officer-resume-sample
fleet-maintenance-manager-resume-samples
format-for-resume-writing
fresher-computer-engineers-resume-sample
fresher-hr-resume-sample
fresher-hr-resume-sample-2
fresher-lecturer-resume
Amazing Article,Really useful information to all So, I hope you will share more information to be check and share here.
ReplyDeleteinplant training
inplant training chennai
inplant training meaning
inplant training certificate
inplant training report
report for inplant training
inplant training certificate format
inplant training meaning in tamil
what is inplant training
inplant training in chennai for mechanical
Wow, amazing post! Really engaging, thank you.
ReplyDeleteSpark Training In Bangalore
Apache Spark Training in Bangalore
I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.
ReplyDeleteOracle Fusion HCM Training
Workday Training
Okta Training
Palo Alto Training
Adobe Analytics Training