Пример #1
0
  public void setAllDetails() {
    arrayAdapter.clear();
    List<Integer> ids = AppToServer.getAllUserId();
    List<String> unames = AppToServer.getAllUserUname();
    List<String> nnames = AppToServer.getAllUserNname();
    boolean flag = false;
    for (int i = 0; i < ids.size(); i++) {
      // ids.get(i) + " > " + unames.get(i) + " (" + nnames.get(i) + ")\n";
      arrayAdapter.add(
          new userinfo_element(
              unames.get(i), nnames.get(i), ids.get(i), (flag = !flag), null, "", -1, true));
    }

    arrayAdapter.notifyDataSetChanged();
  }
Пример #2
0
  void refreshAdapterOnline() {
    List<Integer> OnlineID = AppToServer.getOnlineIDS();
    if (OnlineID == null) return;

    for (int i = 0; i < arrayAdapter.getCount(); i++) {
      userinfo_element item = arrayAdapter.getItem(i);
      item.setIsOnline(false);
    }
    for (int i = 0; i < OnlineID.size(); i++) {
      int pos = arrayAdapter.getPositionById((int) OnlineID.get(i));

      if (pos >= 0) {
        userinfo_element item = arrayAdapter.getItem(pos);
        item.setIsOnline(true);
      }
    }
    arrayAdapter.notifyDataSetChanged();
  }