Fix the tab focus when view pager current page changes.

Bug 27548047

Change-Id: I3ed4202b0077b965d3dafec2d969d3ddf7d5737c
diff --git a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java
index 211016d..55cee0b 100644
--- a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java
+++ b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java
@@ -28,6 +28,7 @@
 import android.support.v13.app.FragmentStatePagerAdapter;
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.ViewPager;
+import android.view.ViewGroup;
 
 public class ShortcutLauncherMain extends Activity {
     private LauncherApps mLauncherApps;
@@ -102,5 +103,12 @@
         public int getCount() {
             return 2;
         }
+
+        @Override
+        public void setPrimaryItem(ViewGroup container, int position, Object object) {
+            super.setPrimaryItem(container, position, object);
+
+            getActionBar().selectTab(getActionBar().getTabAt(position));
+        }
     }
 }