title: How to call fragment from a java class in android?
body: <p>I am calling a one fragment from a java class, on click of one textview I am calling one fragment this is my code of onclick.</p>
  
  <pre><code>returnTheProduct.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View view) {
                FragmentManager fragmentManager = context.getFragmentManager();
                FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                ProductReturnFragment productReturnFragment = new ProductReturnFragment();
                fragmentTransaction.replace(R.id.layout_marketplace_forms, new MarketPlaceFormsActivity());
                fragmentTransaction.addToBackStack(null);
                fragmentTransaction.commit();
              }
            });   
  </code></pre>