0

I have a viewpager (hold by an Activity) with several fragments that are never destroyed. When I switch the application to the background, all my fragments change to the onStop() state. When the application returns to foreground, the current fragment is onResume() but not the others. But on the other hand, I still pass in the onItemSelected() of my spinner when I'm not even on the fragment containing it.

diAz
  • 478
  • 4
  • 16
  • Show us what have you tried> – Kaushik Burkule Sep 23 '19 at 09:13
  • Spinners are buggy. Don't use it. Consider using ExposedDropdownMenu from the material components – denvercoder9 Sep 23 '19 at 09:14
  • It's true that this is not the first time I've been embarrassed with spinners ^^ – diAz Sep 23 '19 at 09:15
  • @sonnet thanks i will try this component – diAz Sep 23 '19 at 09:17
  • https://stackoverflow.com/questions/54004976/in-android-how-to-create-an-outlined-dropdown-menu-spinner-as-specified-by-th – denvercoder9 Sep 23 '19 at 09:20
  • it doesn't actually fix my problem because it's just style. Nevertheless, thank you because my spinner is prettier now. – diAz Sep 23 '19 at 09:39
  • That link is not just about style. ExposedDropdownMenu works (and is defined) differently than a Spinner. See your relevant spinner issue here: https://stackoverflow.com/questions/1337424/android-spinner-get-the-selected-item-change-event – denvercoder9 Sep 23 '19 at 09:47
  • I solved my problem by checking if my adapter was not null. Because I was actually adding a new adapter for my spinner every time... sorry – diAz Sep 23 '19 at 09:51

0 Answers0