stepstone-tech / android-material-app-rating

This library allows to use customized Rating Dialog inside applications.
Apache License 2.0
474 stars 86 forks source link

RatingDialogListener in CustomAdapter #34

Closed sohampandya00 closed 6 years ago

sohampandya00 commented 6 years ago

I am Showing rating dialog on listviewitem click . and listview is inside fragment . so is it possible to create rating dialog listner inside the custom adapter ?

pglebocki commented 6 years ago

Hello @sohampandya00,

Basically listener must be implemented by activity. This is the same like in standard android pattern : https://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents

We cannot implement passing explicit callback e.g. "setDialogListener" bacause it can cause some serialization problems when turning off display or rotating device.

Regarding your question. You should not create dialog's listener directly indside adapter. You can implement RatingDialogListener to your activity and then delegate events to adapter.

BR, Piotr