0

In brief, I am going to build a Project with swipeView and the fragments.

  1. MainActivity.java
    a. ListViewFragment.java
    b. DetialFragment1.java
    c. DetialFragment3.java
    d. DetialFragment4.java
    e. DetialFragment5.java

MainActivity.java contain the swipeView layout with all other fragments mentioned above. When I first open my app it display the listView fragment of the swipeView. And onSwipe the fragments are swipe one by one which is okey. But I also want .. when I click the fragment listView onItem 4 , It should directly show DetialFragment4 with the capability to swipe other fragments. PLEASE HELP....

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
jazzbpn
  • 6,441
  • 16
  • 63
  • 99

1 Answers1

0

Finally got the answer. I'm sorry but this time stackoverflow is lil bit slow... waiting and waiting with no answer. And now, I found answer ..

MainActivity.java

 public static void getViewPagerAtCurrentPosition(int position)
 {
 viewPager.setCurrentItem(position);
 }

FragmentA.java

switch (position) {
    case 0:
        MainActivity.getViewPagerAtCurrentPosition(1);
        break;
    case 1:
        MainActivity.getViewPagerAtCurrentPosition(2);
        break;
    case 2:
        MainActivity.getViewPagerAtCurrentPosition(3);
        break;
    case 3:
        MainActivity.getViewPagerAtCurrentPosition(4);
        break;
}
jazzbpn
  • 6,441
  • 16
  • 63
  • 99