Code example for ArrayList

Methods: add, addAll

0
     * 
     * @param realAccounts 
     *         An array of accounts to display. 
     */ 
    public void populateListView(Account[] realAccounts) {
        List<BaseAccount> accounts = new ArrayList<BaseAccount>();
 
        if (displaySpecialAccounts() && !K9.isHideSpecialAccounts()) { 
            BaseAccount unifiedInboxAccount = SearchAccount.createUnifiedInboxAccount(this);
            BaseAccount allMessagesAccount = SearchAccount.createAllMessagesAccount(this);
 
            accounts.add(unifiedInboxAccount);
            accounts.add(allMessagesAccount);
        } 
 
        accounts.addAll(Arrays.asList(realAccounts));
        AccountsAdapter adapter = new AccountsAdapter(accounts);
        ListView listView = getListView();
        listView.setAdapter(adapter);
        listView.invalidate();
    }