Code example for ListFragment

Methods: setListAdapter, getActivity, onCreate

0
    public GFWorkoutListFragment() { 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(getActivity(),R.layout.simple_list_item_activated_1,R.id.text1,new String [] {"Plyometrics","Cardio","Legs","Arms","Chest","Back","Abs","Shoulder"}));
 
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    } 
     
    @Override 
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (!(activity instanceof Callbacks)) {
            throw new IllegalStateException("Activity must implement fragment's callbacks.");
Contextual code suggestions in your IDE  Get Codota for Java