Stay organized with collections
Save and categorize content based on your preferences.
OnRatingBarChangeListener
interface 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 Unit |
Notification that the rating has changed.
|
Public methods
onRatingChanged
abstract fun onRatingChanged(
ratingBar: RatingBar!,
rating: Float,
fromUser: Boolean
): Unit
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnRatingBarChangeListener\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/RatingBar.OnRatingBarChangeListener \"View this page in Java\") \n\n```\ninterface OnRatingBarChangeListener\n```\n\n|---------------------------------------------------------|\n| [android.widget.RatingBar.OnRatingBarChangeListener](#) |\n\nA 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.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRatingChanged](#onRatingChanged(android.widget.RatingBar,%20kotlin.Float,%20kotlin.Boolean))`(`ratingBar:` `[RatingBar](/reference/kotlin/android/widget/RatingBar)!`, `rating:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `fromUser:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Notification that the rating has changed. |\n\nPublic methods\n--------------\n\n### onRatingChanged\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onRatingChanged(\n ratingBar: RatingBar!, \n rating: Float, \n fromUser: Boolean\n): Unit\n```\n\nNotification 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.\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ratingBar` | [RatingBar](/reference/kotlin/android/widget/RatingBar)!: The RatingBar whose rating has changed. |\n| `rating` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The current rating. This will be in the range 0..numStars. |\n| `fromUser` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): True if the rating change was initiated by a user's touch gesture or arrow key/horizontal trackbell movement. |"]]