Code example for ListFragment

Methods: onDestroyViewsetListAdapter

0
        setListAdapter(adapter);
    } 
 
    @Override 
    public void onDestroyView() { 
        super.onDestroyView(); 
        setListAdapter(null);
    } 
 
    @Override 
    public void addToList(Token token) {
        String endingIn = getResources().getString(R.string.endingIn);
        Map<String, String> map = new HashMap<String, String>();
        map.put("last4", endingIn + " " + token.getCard().getLast4());
        map.put("tokenId", token.getId());
        listItems.add(map);
        adapter.notifyDataSetChanged();
    } 
 
} 
Connect your IDE to all the code out there  Get Codota for Java