I'm new to android, trying to send a bundle from a Activity to Fragment using
Bundle args = new Bundle();
args.putString("name", "XXXXXXX");
FragmentTab1 fTab1 = new FragmentTab1();
fTab1.setArguments(args);
and in FragmentTab1 onCreate method as follows:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragmenttab1.xml
View view = inflater.inflate(R.layout.fragmenttab1, container, false);
Bundle bundle = this.getArguments();
if (bundle != null) {
name = bundle.getString("name");
}
TextView nameView = (TextView) view.findViewById(R.id.dinesh);
nameView.setText(name);
return view;
}
getting null pointer exception
at Bundle bundle = this.getArguments();
please help me to trace this exception