Code example for ListFragment

Methods: setListAdapter, getActivity, onResume

0
        GroupAPIEngine.getSharedEngine().removeDelegate(this);
    } 
 
    @Override 
    public void onResume() { 
        super.onResume(); 
        onEngineDidLoadUsers(); 
        GroupAPIEngine.getSharedEngine().addDelegate(this);
        GroupAPIEngine.getSharedEngine().fetchPosts(); 
    } 
 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        Toast.makeText(getActivity().getBaseContext(),
                       this.users.get(position).toString(),
                       Toast.LENGTH_SHORT).show();
    } 
 
 
    // GroupAPIEngineDelegate Interface Methods 
    @Override 
    public void onEngineError(Error error) {
        Toast.makeText(getActivity().getBaseContext(),
                       "An error occurred.", 
                       Toast.LENGTH_SHORT).show();
    } 
 
    @Override 
    public void onEngineDidLoadUsers() { 
        this.users = DatabaseManager.getSharedManager().getAllUsers();
        setListAdapter(new ArrayAdapter<User>(getActivity(),
                                              android.R.layout.simple_list_item_1,
                                              this.users));
    } 
 
    @Override