Stay organized with collections
Save and categorize content based on your preferences.
RatingBar.OnRatingBarChangeListener
public
static
interface
RatingBar.OnRatingBarChangeListener
android.widget.RatingBar.OnRatingBarChangeListener
|
A callback that notifies clients when the rating has been changed. This
includes changes that were initiated by the user through a touch gesture
or arrow key/trackball as well as changes that were initiated
programmatically.
Summary
Public methods |
abstract
void
|
onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser)
Notification that the rating has changed.
|
Public methods
public abstract void onRatingChanged (RatingBar ratingBar,
float rating,
boolean fromUser)
Notification that the rating has changed. Clients can use the
fromUser parameter to distinguish user-initiated changes from those
that occurred programmatically. This will not be called continuously
while the user is dragging, only when the user finalizes a rating by
lifting the touch.
Parameters |
ratingBar |
RatingBar : The RatingBar whose rating has changed. |
rating |
float : The current rating. This will be in the range
0..numStars. |
fromUser |
boolean : True if the rating change was initiated by a user's
touch gesture or arrow key/horizontal trackbell movement. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# RatingBar.OnRatingBarChangeListener\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nRatingBar.OnRatingBarChangeListener\n===================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/widget/RatingBar.OnRatingBarChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nRatingBar.OnRatingBarChangeListener\n`\n\n\n`\n\n\n`\n\n|----------------------------------------------------|\n| android.widget.RatingBar.OnRatingBarChangeListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA callback that notifies clients when the rating has been changed. This\nincludes changes that were initiated by the user through a touch gesture\nor arrow key/trackball as well as changes that were initiated\nprogrammatically.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onRatingChanged](/reference/android/widget/RatingBar.OnRatingBarChangeListener#onRatingChanged(android.widget.RatingBar,%20float,%20boolean))`(`[RatingBar](/reference/android/widget/RatingBar)` ratingBar, float rating, boolean fromUser) ` Notification that the rating has changed. |\n\nPublic methods\n--------------\n\n### onRatingChanged\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onRatingChanged (RatingBar ratingBar, \n float rating, \n boolean fromUser)\n```\n\nNotification that the rating has changed. Clients can use the\nfromUser parameter to distinguish user-initiated changes from those\nthat occurred programmatically. This will not be called continuously\nwhile the user is dragging, only when the user finalizes a rating by\nlifting the touch.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------|\n| `ratingBar` | `RatingBar`: The RatingBar whose rating has changed. \u003cbr /\u003e |\n| `rating` | `float`: The current rating. This will be in the range 0..numStars. \u003cbr /\u003e |\n| `fromUser` | `boolean`: True if the rating change was initiated by a user's touch gesture or arrow key/horizontal trackbell movement. \u003cbr /\u003e |"]]