Java Code Examples for android.widget.ListView.invalidate()

The following are Jave code examples for showing how to use invalidate() of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: q-mail   File: AccountList.java   Source Code and License Vote up 6 votes
/**
 * Create a new {@link AccountsAdapter} instance and assign it to the {@link ListView}.
 *
 * @param realAccounts
 *         An array of accounts to display.
 */
public void populateListView(List<Account> realAccounts) {
    List<BaseAccount> accounts = new ArrayList<BaseAccount>();

    if (displaySpecialAccounts() && !QMail.isHideSpecialAccounts()) {
        BaseAccount unifiedInboxAccount = SearchAccount.createUnifiedInboxAccount(this);
        BaseAccount allMessagesAccount = SearchAccount.createAllMessagesAccount(this);

        accounts.add(unifiedInboxAccount);
        accounts.add(allMessagesAccount);
    }

    accounts.addAll(realAccounts);
    AccountsAdapter adapter = new AccountsAdapter(accounts);
    ListView listView = getListView();
    listView.setAdapter(adapter);
    listView.invalidate();
}