I have a Seekbar and I want to save the state to database when the progress is changed.
I am wondering in which event to put my code onProgressChanged vs. onStopTrackingTouch?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I am going to disagree with both mbaird and jqpubliq, for one simple reason: they assume the user is using a touchscreen.
Most Android devices have touchscreens. Not all will. For example, there are firms developing Android set-top boxes (think Android equivalents of Roku or Boxee Box). Most televisions are not touchscreens.
Now, if you want your application to only be usable with a touchscreen — and you have set the appropriate
<uses-configuration>elements in your manifest —onStopTrackingTouch()may be reliable for detecting a progress change.Personally, I would update the database on neither
onProgressChanged()noronStopTrackingTouch(), but at the point when the user does something positive to indicate they want to persist the current screen’s contents — pressing the BACK button, clicking a Save button, etc. But I certainly would not rely ononStopTrackingTouch()unless you are developing a touchscreen-only app.