title: How to send data to default fragment using navigation drawer?
body: <p>I am using navigation drawer. I want to send array list to default fragment. but i check that in my default fragment it always shows null. Following is my code for navigation drawer and default fragment. in my fragment i am receiving data from main activity can any one help me to solve this?</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          FacebookSdk.sdkInitialize(getApplicationContext());
          callbackManager = CallbackManager.Factory.create();
          setContentView(R.layout.activity_main);
          fcm_id = FirebaseInstanceId.getInstance().getToken();
          session = new SessionManager(getApplicationContext());
          prodcounter=session.usercounter();
          mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
  
  
          Bundle bundles = new Bundle();
          bundles.putString(FirebaseAnalytics.Param.ITEM_ID, "btn_click");
          bundles.putString(FirebaseAnalytics.Param.ITEM_NAME, "Next Activity");
          bundles.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
          mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundles);
          //Logs an app event.
          mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundles);
  
          //Sets whether analytics collection is enabled for this app on this device.
          mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
  
          //Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds). Let's make it 20 seconds just for the fun
          mFirebaseAnalytics.setMinimumSessionDuration(20000);
  
          //Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes).
          mFirebaseAnalytics.setSessionTimeoutDuration(500);
          System.out.println("Parent Counter : " + prodcounter);
        //  id = getIntent().getStringExtra("id");
          userid = session.userID();
          System.out.println("Parent ID : " + userid);
  
          userd=Long.parseLong(userid);
          prefss = getApplicationContext().getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
          prefimmg = prefss.getString("prefimgg", null);
          prefnmms = prefss.getString("prefnmss", null);
          System.out.println("Parent Activity Promocode"+promocodestore+prefimmg+prefnmms);
          toolbar = (Toolbar) findViewById(R.id.toolbar);
  
          cartcounter = (TextView) toolbar.findViewById(R.id.textOne);
          noticounter=(TextView) toolbar.findViewById(R.id.texttwo);
          if(prodcounter==null || prodcounter.equals("0"))
          {
              cartcounter.setVisibility(View.GONE);
              System.out.println("HomeFrag Counter null:");
          }
          else
          {
              cartcounter.setVisibility(View.VISIBLE);
              System.out.println("HomeFrag Counter notnull:");
              cartcounter.setText(" "+prodcounter+" ");
          }
          cartcounter.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  if(prodcounter==null || prodcounter.equals("0"))
                  {
                      Toast.makeText(MainActivity.this, "Your Shopping Cart is Empty", Toast.LENGTH_SHORT).show();
                  }
                  else
                  {
                      Bundle bundle=new Bundle();
                      FragmentManager fragmentManager = getFragmentManager();
                      BuyNowActivity llf = new BuyNowActivity();
                      llf.setArguments(bundle);
                      fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
                  }
              }
          });
          imgserach=(ImageView)toolbar.findViewById(R.id.imagesearch);
  
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
         setSupportActionBar(toolbar);
          mActivityTitle = getTitle().toString();
  
  
          ExpandList = (ExpandableListView) findViewById(R.id.navList);
        //  mSelectedItemView = (TextView) findViewById(R.id.selected_item);
          ViewTreeObserver vto = ExpandList.getViewTreeObserver();
          vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                  ExpandList.setIndicatorBounds(ExpandList.getRight() - 40, ExpandList.getWidth());
              }
          });
  
          LayoutInflater inflater = getLayoutInflater();
          View listHeaderView = inflater.inflate(R.layout.nav_header, null, false);
          headerimg=(ImageView)listHeaderView.findViewById(R.id.filmIcon);
          headertxt=(TextView)listHeaderView.findViewById(R.id.website);
          ExpandList.addHeaderView(listHeaderView);
  
          if(prefimmg!=null)
          {
              Picasso.with(MainActivity.this)
                      .load(prefimmg)
                      .error(com.bpc.us.project.R.drawable.nopreview )
                      .placeholder(com.bpc.us.project.R.drawable.progress_animation)
                      .into(headerimg);
          }
          else
          {
              Picasso.with(MainActivity.this)
                      .load(R.drawable.user)
                      .error(com.bpc.us.project.R.drawable.nopreview )
                      .placeholder(com.bpc.us.project.R.drawable.progress_animation)
                      .into(headerimg);
          }
          if(prefnmms!=null)
          {
              headertxt.setText(prefnmms);
          }
          else
          {
              headertxt.setText("My Account");
          }
  
       //   mExpandableListData = ExpandableListDataSource.getData(this);
          pDialog = new ProgressDialog(this);
          pDialog.setMessage("Please wait...");
          pDialog.setCancelable(false);
  
          Drawerdata();
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setHomeButtonEnabled(true);
  
  
          if(getIntent().getExtras()!=null){
  
              if(getIntent().getExtras().getBoolean("ForFBGOOGLE"))
              {
                  Bundle bundle=new Bundle();
                  FragmentManager fragmentManager = getFragmentManager();
                  FBGoogleAddress llf = new FBGoogleAddress();
                  llf.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
              }
              else if(getIntent().getExtras().getBoolean("ForDelieveringProduct"))
              {
                  Bundle bundle=new Bundle();
                  FragmentManager fragmentManager = getFragmentManager();
                  DelieveringProduct llf = new DelieveringProduct();
                  llf.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
              }
              else if(getIntent().getExtras().getBoolean("ForOrderActivity"))
              {
                  Bundle bundle=new Bundle();
                  FragmentManager fragmentManager = getFragmentManager();
                  OrderActivity llf = new OrderActivity();
                  llf.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
              }
              else if(getIntent().getExtras().getBoolean("fromskips"))
              {
                  Bundle bundle=new Bundle();
                  bundle.putSerializable("imagesliderlist", imagesliderlist);
                  bundle.putString("offerBandText", offerBandText);
                  FragmentManager fragmentManager = getFragmentManager();
                   currentFragment = new HomeFragments();
                  currentFragment.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, currentFragment).addToBackStack(null).commit();
              }
              else if(getIntent().getExtras().getBoolean("forfailure"))
              {
                  placeorderlists =  (ArrayList&lt;PlaceOrderModel&gt;)getIntent().getSerializableExtra("placeorderitems");
                  // placeordershippinglists =  (ArrayList&lt;PlaceorderShipping&gt;)getIntent().getSerializableExtra("placeordershippingitems");
                  // placeorderbillinglists =  (ArrayList&lt;Placeorderbilling&gt;)getIntent().getSerializableExtra("placeorderbillingitems");
  
                  subtotal=getIntent().getStringExtra("subtotal");
                  discount=getIntent().getStringExtra("discount");
                  shipVal=getIntent().getStringExtra("shipVal");
                  shippingMethod=getIntent().getStringExtra("shippingMethod");
                  paidAmount=getIntent().getStringExtra("paidAmount");
                  orderid=getIntent().getStringExtra("orderid");
                  shipid=getIntent().getStringExtra("shipid");
                  shiptype=getIntent().getStringExtra("shiptypes");
  
                  Bundle bundle=new Bundle();
                  bundle.putSerializable("placeorderitems", placeorderlists);
                  bundle.putString("subtotal", subtotal);
                  bundle.putString("discount", discount);
                  bundle.putString("shipVal", shipVal);
                  bundle.putString("paidAmount", paidAmount);
                  bundle.putString("orderid", orderid);
                  bundle.putString("shippingMethod", shippingMethod);
                  bundle.putString("shipid", shipid);
                  bundle.putString("shiptypes", shiptype);
                  // FragmentTransaction ft = fm.beginTransaction();
                  FragmentManager fragmentManager = getFragmentManager();
                  PaymentFailure llf = new PaymentFailure();
                  llf.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
              }
  
              else if(getIntent().getExtras().getBoolean("forsuccess"))
              {
                  placeorderlists =  (ArrayList&lt;PlaceOrderModel&gt;)getIntent().getSerializableExtra("placeorderitems");
                  // placeordershippinglists =  (ArrayList&lt;PlaceorderShipping&gt;)getIntent().getSerializableExtra("placeordershippingitems");
                  // placeorderbillinglists =  (ArrayList&lt;Placeorderbilling&gt;)getIntent().getSerializableExtra("placeorderbillingitems");
  
                  orderid=getIntent().getStringExtra("orderid");
                  orderdate=getIntent().getStringExtra("orderdate");
                  total=getIntent().getStringExtra("total");
                  subtotal=getIntent().getStringExtra("subtotal");
                  discount=getIntent().getStringExtra("discount");
                  shipVal=getIntent().getStringExtra("shipVal");
                  shippingMethod=getIntent().getStringExtra("shippingMethod");
                  paidAmount=getIntent().getStringExtra("paidAmount");
                  cardNumber=getIntent().getStringExtra("cardNumber");
                  billfirstname=getIntent().getStringExtra("billfname");
                  billlname=getIntent().getStringExtra("billlname");
                  billadd1=getIntent().getStringExtra("billadd1");
                  billadd2=getIntent().getStringExtra("billadd2");
                  billcity=getIntent().getStringExtra("billcity");
                  billstate=getIntent().getStringExtra("billstate");
                  billcountry=getIntent().getStringExtra("billcountry");
                  billzip=getIntent().getStringExtra("billzip");
                  billphone=getIntent().getStringExtra("billphone");
                  shipfname=getIntent().getStringExtra("shipfname");
                  shiplname=getIntent().getStringExtra("shiplname");
                  shipadd1=getIntent().getStringExtra("shipadd1");
                  shipadd2=getIntent().getStringExtra("shipadd2");
                  shipcity=getIntent().getStringExtra("shipcity");
                  shipstate=getIntent().getStringExtra("shipstate");
                  shipcountry=getIntent().getStringExtra("shipcountry");
                  shipzip=getIntent().getStringExtra("shipzip");
                  shipphone=getIntent().getStringExtra("shipphone");
  
                  Bundle bundle=new Bundle();
                  bundle.putSerializable("placeorderitems", placeorderlists);
                  bundle.putString("orderid", orderid);
                  bundle.putString("orderdate", orderdate);
                  bundle.putString("total", total);
                  bundle.putString("subtotal", subtotal);
                  bundle.putString("discount", discount);
                  bundle.putString("shippingMethod", shippingMethod);
                  bundle.putString("shipVal", shipVal);
                  bundle.putString("paidAmount", paidAmount);
                  bundle.putString("cardNumber", cardNumber);
                  bundle.putString("billfname", billfirstname);
                  bundle.putString("billlname", billlname);
                  bundle.putString("billadd1", billadd1);
                  bundle.putString("billadd2", billadd2);
                  bundle.putString("billcity", billcity);
                  bundle.putString("billstate", billstate);
                  bundle.putString("billcountry", billcountry);
                  bundle.putString("billzip", billzip);
                  bundle.putString("billphone", billphone);
                  bundle.putString("shipfname", shipfname);
                  bundle.putString("shiplname", shiplname);
                  bundle.putString("shipadd1", shipadd1);
                  bundle.putString("shipadd2", shipadd2);
                  bundle.putString("shipcity", shipcity);
                  bundle.putString("shipstate", shipstate);
                  bundle.putString("shipcountry", shipcountry);
                  bundle.putString("shipzip", shipzip);
                  bundle.putString("shipphone", shipphone);
                  // FragmentTransaction ft = fm.beginTransaction();
                  FragmentManager fragmentManager = getFragmentManager();
                  PaymentSuccessful llf = new PaymentSuccessful();
                  llf.setArguments(bundle);
                  fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
              }
              else
              {
                  if (savedInstanceState == null){
                     /*currentFragment = new HomeFragments();
                      getFragmentManager().beginTransaction().add(R.id.frame_container, currentFragment).commit();*/
  
                      Bundle bundle=new Bundle();
                      bundle.putSerializable("imagesliderlist", imagesliderlist);
                      bundle.putString("offerBandText", offerBandText);
                      FragmentManager fragmentManager = getFragmentManager();
                      currentFragment = new HomeFragments();
                      currentFragment.setArguments(bundle);
                      fragmentManager.beginTransaction().add(R.id.frame_container, currentFragment).commit();
                  }
              }
          }
          addDrawerItems();
          setupDrawer();
          listHeaderView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if(userd &gt; 0)
                  {
                      System.out.println("Positive");
                     /* Intent intent=new Intent(ParentActivity.this,OrderActivity.class);
                      startActivity(intent);*/
                      Bundle bundle=new Bundle();
                      // FragmentTransaction ft = fm.beginTransaction();
                      FragmentManager fragmentManager = getFragmentManager();
                      OrderActivity llf = new OrderActivity();
                      llf.setArguments(bundle);
                      fragmentManager.beginTransaction().replace(com.bpc.us.project.R.id.frame_container, llf).addToBackStack(null).commit();
                      mDrawerLayout.closeDrawer(ExpandList);
                  }
                  else
                  {
                      System.out.println("Negative");
                      // String skipsid=String.valueOf(userd);
                      Intent intent=new Intent(MainActivity.this,Login_Page.class);
             /* intent.putExtra("proceedtocheckoutid",skipsid);
              intent.putExtra("isCheckOut",true);*/
                      startActivity(intent);
                  }
  
  
              }
          });
  
          //GetNotification();
  
      }
  </code></pre>
  
  <p>HomeFragment</p>
  
  <pre><code> sliderimagelist =  (ArrayList&lt;ImagesliderModel&gt;)getArguments().getSerializable("imagesliderlist");
  
          offerBandText=getArguments().getString("offerBandText");
  
          System.out.println("IMAGELISTSIZE"+sliderimagelist+offerBandText);
  </code></pre>