this is my activity from where I am sending Status
case R.id.buttonMade:
{
Bundle bundle = new Bundle();
Status ="0";
bundle.putString("Status", Status);
FragmentAll fragInfo = new FragmentAll();
fragInfo.setArguments(bundle);
Log.e(bundle.toString(),bundle.toString());
startActivity(new Intent(FrontPageActivity.this, OrdersActivity.class));
break;
}
This is my Fragment JAVA class
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.fragment_order_all, container, false);
sh_pref=getContext().getSharedPreferences("start", getContext().MODE_PRIVATE);
uName = sh_pref.getString("username", null);
final Bundle bundle = getArguments();
Status1=bundle.getString("Status");
if(Status1==null)
Toast.makeText(getActivity(),"Null",Toast.LENGTH_LONG).show();
>error is
Java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
I am able to pass data from activity but unable to get in fragment what the issue
Thank you