at least in androidx.appcompat:appcompat:1.2.0 androidx.appcompat.widget.Toolbar#getTitle returns a StringBuffer on API-Level 30 (Samsung). So toolbar.title can never be equal with the string title. toString() fixes that and should also work with other implementations, which return CharSequence or String.
at least in
androidx.appcompat:appcompat:1.2.0 androidx.appcompat.widget.Toolbar#getTitle
returns aStringBuffer
on API-Level 30 (Samsung). Sotoolbar.title
can never be equal with the stringtitle
.toString()
fixes that and should also work with other implementations, which returnCharSequence
orString
.