Before asking i have been through the similar questions and tried them but no success and every time it all ends with a null pointer exception. All i want to do is pass the username which is in string from one activity to another fragment of my tabbed activity. Here is what i tried, my main activity codes
Bundle bundle = new Bundle();
                bundle.putString("NAME", username);
                //PASS OVER THE BUNDLE TO OUR FRAGMENT
                ProfileFragment profileFragment = new ProfileFragment();
                profileFragment.setArguments(bundle);
                startActivity(new Intent(MainActivity.this, TabbedAct.class));
And codes from ProfileFragment
 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_profile, container, false);
    profilename = (TextView) rootView.findViewById(R.id.profile);
    String name= this.getArguments().getString("NAME");
    profilename.setText(name);
    return rootView;
}
 
     
    