Code example for ListFragment

Methods: getArguments

0
    public static final String ARG_LAYOUT_RESID = "layout_resid";
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
      final int layoutResId = getArguments().getInt(ARG_LAYOUT_RESID);
      return inflater.inflate(layoutResId, container, false);
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      setListAdapter(new ArrayAdapter<String>(getActivity(),
          android.R.layout.simple_list_item_1, Cheeses.sCheeseStrings));
    } 
  } 
} 
Experience pair programming with AI  Get Codota for Java