title: Add tab programmatically with PagerSlidingTabStrip
body: <p>I use <a href="https://github.com/astuetz/PagerSlidingTabStrip" rel="nofollow">PagerSlidingTabStrip</a> for create a ViewPager inside my main layout. I want add some tabs dynamically, with different layout for every fragment. 
  for example:</p>
  
  <pre><code>if (var == 1)
      tab.add("tab1", R.layout.fragment1);
      tab.add("tab2", R.layout.fragment2);
      tab.add("tab3", R.layout.fragment3);
  else if (var == 2)
      tab.add("tab2", R.layout.fragment2);
  else
      // Other tabs
  </code></pre>
  
  <p>and the fragment must receive a string parameter passed from the main activity.</p>
  
  <pre><code>public class fragment1 extends Fragment
  {
      private static final String ARG_POSITION = "position";
      private static final String ARG_TYPE = "type";
      private int position;
      private String type;
  
      public static fragment1 newInstance(int position, String type)
      {
          fragment1 f = new fragment1();
          Bundle b = new Bundle();
          b.putInt(ARG_POSITION, position);
          b.putString(ARG_TYPE, type);
          f.setArguments(b);
          return f;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
  
          position = getArguments().getInt(ARG_POSITION);
          type = getArguments().getString(ARG_TYPE);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup cointainer, Bundle savedInstanceState)
      {
          View myFragView = inflater.inflate(R.layout.frag_sinonimi, cointainer, false);
          return myFragView;
      }
  }
  </code></pre>
  
  <p>How i can add some tabs dynamically with parameters passed at the different fragments?</p>