I tried this with a TabWidget instead of the Radio buttons. Instead of the onCheckedChangedListener I'm using an onClickListener. Though, I'm sure this applies to radio buttons too.
When a radio button is checked, we set the current screen:
mPager.setCurrentScreen(0, true);
The second parameter implies an animation for 500 ms. This makes the UI thread block, which in turn delays the Radio button update. E.g.:
- User clicks button.
- Button is highlighted.
- Page change is animated for 500 ms.
- Button is checked.
Instead, we should check the button immediately (as if the animation was disabled) and then animate the page change. This is how it's done in the Music app.
Hence, we need to make an asynchronous call to snapToScreen() inside setCurrentScreen(). Post runnable? Any ideas?
I tried this with a TabWidget instead of the Radio buttons. Instead of the onCheckedChangedListener I'm using an onClickListener. Though, I'm sure this applies to radio buttons too.
When a radio button is checked, we set the current screen:
mPager.setCurrentScreen(0, true);
The second parameter implies an animation for 500 ms. This makes the UI thread block, which in turn delays the Radio button update. E.g.:
Instead, we should check the button immediately (as if the animation was disabled) and then animate the page change. This is how it's done in the Music app.
Hence, we need to make an asynchronous call to snapToScreen() inside setCurrentScreen(). Post runnable? Any ideas?