title: How to intent string from fragment to another activity
body: <p>I have activity <code>A</code> and activity <code>B</code>.</p>
  
  <p>I have 4 fragments (not listfragment) which contain custom listview with image and text that I put in activity <code>A</code>. It is a TabLayout and swipeable. </p>
  
  <p>How to intent the string from fragment to another activity?</p>
  
  <p>Here is one of my fragments:</p>
  
  <pre><code>public class BusinessSolutionHelperFragment extends Fragment {
  
      public BusinessSolutionHelperFragment() {
          // Required empty public constructor
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);    
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          // Inflate the layout for this fragment
          View rootView = inflater.inflate(R.layout.first_fragment_layout, container, false);
  
          RecyclerView rv = (RecyclerView) rootView.findViewById(R.id.rv_recycler_view);
          rv.setHasFixedSize(true);
  
          MyAdapter adapter = new MyAdapter(new String[]{
                  "Sales Promotion Girl (SPG)",
                  "Sales Promotion Boy (SPB)",    
          });    
  
          rv.setAdapter(adapter);    
  
          LinearLayoutManager llm = new LinearLayoutManager(getActivity());
          rv.setLayoutManager(llm); 
  
          return rootView;
      }
  </code></pre>
  
  <p>And here is my MainActivity :</p>
  
  <pre><code>public class MenuHelperInsiti extends AppCompatActivity {
  
              @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.menu_helper_insiti);
  
                  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                  setSupportActionBar(toolbar);
  
                  // Get the ViewPager and set it's PagerAdapter so that it can display items
                  ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
                  PagerAdapter pagerAdapter =
                          new PagerAdapter(getSupportFragmentManager(), MenuHelperInsiti.this);
                  viewPager.setAdapter(pagerAdapter);
  
                  // Give the TabLayout the ViewPager
                  TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
                  tabLayout.setupWithViewPager(viewPager);
  
                  // Iterate over all tabs and set the custom view
                  for (int i = 0; i &lt; tabLayout.getTabCount(); i++) {
                      TabLayout.Tab tab = tabLayout.getTabAt(i);
                      tab.setCustomView(pagerAdapter.getTabView(i));
                  }            
              }            
  
              @Override
              public void onResume() {
                  super.onResume();
              }
              @Override
              public boolean onCreateOptionsMenu(Menu menu) {
                  // Inflate the menu; this adds items to the action bar if it is present.
                  getMenuInflater().inflate(R.menu.menu_main, menu);
                  return true;
              }
  
              @Override
              public boolean onOptionsItemSelected(MenuItem item) {
                  int id = item.getItemId();
  
                  if (id == R.id.action_settings) {
                      return true;
                  }
  
                  return super.onOptionsItemSelected(item);
              }
  
              class PagerAdapter extends FragmentPagerAdapter {
  
                  String tabTitles[] = new String[] {
                          "Home Solution Helper",
                          "Party &amp; Event Helper",
                          "Business Solution Helper",
                          "Professional Helper",
                             };
                  Context context;
  
                  public PagerAdapter(FragmentManager fm, Context context) {
                      super(fm);
                      this.context = context;
                  }
  
                  @Override
                  public int getCount() {
                      return tabTitles.length;
                  }
  
                  @Override
                  public Fragment getItem(int position) {
  
                      switch (position) {
                          case 0:
                              return new HomeSolutionHelperFragment();
                          case 1:
                              return new PartyEventHelperFragment();
                          case 2:
                              return new BusinessSolutionHelperFragment();
                          case 3:
                              return new ProfessionalHelperFragment();
                                      }
  
                      return null;
                  }
  
                  @Override
                  public CharSequence getPageTitle(int position) {
                      // Generate title based on item position
                      return tabTitles[position];
                  }
  
                  public View getTabView(int position) {
                      View tab = LayoutInflater.from(MenuHelperInsiti.this).inflate(R.layout.custom_tab, null);
                      TextView tv = (TextView) tab.findViewById(R.id.custom_text);
                      tv.setText(tabTitles[position]);
                      return tab;
                  }            
              }   
  </code></pre>
  
  <p>Here is my first_fragment_layout</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/rv_recycler_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
      &lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And here is my tab_layout:   </p>
  
  <pre><code>    &lt;RelativeLayout
      android:id="@+id/main_layout"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MenuHelperInsiti"&gt;    
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:background="?attr/colorPrimary"
          android:elevation="6dp"
          android:minHeight="?attr/actionBarSize"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
          /&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tab_layout"
          android:layout_below="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="80dp"
          android:background="?attr/colorPrimary"
          android:elevation="6dp"
          app:tabTextColor="#d3d3d3"
          app:tabSelectedTextColor="#ffffff"
          app:tabIndicatorColor="#ff00ff"
          android:minHeight="?attr/actionBarSize"
          app:tabGravity="fill"
          app:tabMode="scrollable"
  
                                  /&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_below="@+id/tab_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And here is the Adapter:   </p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.MyViewHolder&gt; {
  private String[] mDataset;
  
  // Provide a reference to the views for each data item
  // Complex data items may need more than one view per item, and
  // you provide access to all the views for a data item in a view holder
  public static class MyViewHolder extends RecyclerView.ViewHolder {
      public CardView mCardView;
      public TextView mTextView;
      public MyViewHolder(View v) {
          super(v);
  
          mCardView = (CardView) v.findViewById(R.id.card_view);
          mTextView = (TextView) v.findViewById(R.id.tv_text);
      }
  }
  
  // Provide a suitable constructor (depends on the kind of dataset)
  public MyAdapter(String[] myDataset) {
      mDataset = myDataset;
  }
  
  // Create new views (invoked by the layout manager)
  @Override
  public MyAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
                                                   int viewType) {
      // create a new view
      View v = LayoutInflater.from(parent.getContext())
              .inflate(R.layout.card_item, parent, false);
  
      // set the view's size, margins, paddings and layout parameters
      MyViewHolder vh = new MyViewHolder(v);
      return vh;
  }
  
  @Override
  public void onBindViewHolder(MyViewHolder holder, int position) {
      holder.mTextView.setText(mDataset[position]);
  }
  
  @Override
  public int getItemCount() {
      return mDataset.length;
  }
  </code></pre>