- // Update the edit button if the folder changes.
- folderSpinner.onItemSelectedListener = object: OnItemSelectedListener {
- override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
- // Update the edit button.
- updateEditButton(currentBookmarkName, currentUrl, currentFolderDatabaseId, currentDisplayOrder)
- }
+ // Wait to set the on item selected listener until the spinner has been inflated. Otherwise the dialog will crash on restart.
+ folderSpinner.post {
+ // Update the save button if the folder changes.
+ folderSpinner.onItemSelectedListener = object: OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
+ // Update the save button.
+ updateSaveButton(currentBookmarkName, currentUrl, currentFolderDatabaseId, currentDisplayOrder)
+ }