tencentAccountAdapter = new AccountListAdapter(AccountManage.this,
tencentUsers);
accountListView.setAdapter(sinaAccountAdapter);
}
从setListAdapter这个方法中,我们可以看到,sinaAccountAdapter的数据源是sinaUsers,而tencentAccountAdapter的数据源是tencentUsers,他们分别通过getSinaUsers()、getTencentUser()方法得到
// 获得新浪用户
private static List getSinaUsers() {
sinaUsers = new ArrayList();
for (UserInfo userInfo : userInfos) {
if (userInfo.getType() == SINA) {
sinaUsers.add(userInfo);
}
}
return sinaUsers;
}
// 获得腾讯用户
private static List getTencentUsers() {
tencentUsers = new ArrayList();
for (UserInfo userInfo : userInfos) {
if (userInfo.getType() == TENCENT) {
tencentUsers.add(userInfo);
}
}
return tencentUsers;
}
我现在要定义动态更新两个帐号列表的方法