Ejemplo n.º 1
0
  public UChannel getChannelByID(Integer id) {

    if (id == null) {
      return null;
    }

    for (UChannel c : this.channels.values()) {
      if (c.getId() == id) {
        return c;
      }
    }
    return null;
  }
Ejemplo n.º 2
0
  // 添加或者修改渠道
  public void saveChannel(UChannel channel) {
    if (channels.containsKey(channel.getChannelID())) {
      channels.remove(channel.getChannelID());
    }

    Log.d("the channel is " + channel);
    UChannel c = getChannelByID(channel.getId());
    if (c != null) {
      channels.remove(c.getChannelID());
    }

    channels.put(channel.getChannelID(), channel);
  }