私はAndroidが初めてで、ActivityからFragmentにバンドルを送信しようとしています
Bundle args = new Bundle();
args.putString("name", "XXXXXXX");
FragmentTab1 fTab1 = new FragmentTab1();
fTab1.setArguments(args);
FragmentTab1 の onCreate メソッドでは次のようになります。
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;
}
取得null pointer exception
_ Bundle bundle = this.getArguments();
この例外を追跡するのを手伝ってください