0

In my app, I am using tab layout, navigation drawer and viewpager with three fragments. In each fragment, I have a spinner and when I changed the value of spinner it goes to server.

But problem is, when I change value of spinner in second tab fragment it automatically open first tab every time.Then I have to slide second tab.

I am using this code-

view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
        override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
        }

        override fun onPageSelected(position: Int) {
            vp_dashboard.setCurrentItem(position, false)
        }

        override fun onPageScrollStateChanged(state: Int) {
        }
    })

So please suggest me how do i refresh the fragment after change the value of spinner in second tab and it doesn't move to first tab by itself.

Ana
  • 174
  • 2
  • 8

1 Answers1

0

I didin't untestood your explonation but about this fragment of text

So please suggest me how do i refresh the fragment after change the value of spinner in second tab and it doesn't move to first tab by itself.

i had simillar issue My problem resolve was put data to DataBase on change and in timer just dowload those data what i needed it's not optimum solution but stiil better than nothing

ppqq
  • 28
  • 7
  • Issue is, whenever I changed the value of spinner in second tab then it moves to first tab. – Ana Jun 01 '18 at 07:19