Ejemplo n.º 1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View itemView = convertView;
      if (itemView == null) {
        itemView =
            getLayoutInflater().inflate(R.layout.activity_search_listviewitem, parent, false);
      }

      // Find building to work with
      DB_Building currentBuilding = value.get(position);

      // Fill the name
      TextView nameText = (TextView) itemView.findViewById(R.id.item_name);
      nameText.setText(currentBuilding.getBuildingName());
      // Fill the times
      TextView timesText = (TextView) itemView.findViewById(R.id.item_times);
      int query_time = currentBuilding.getQueryTime();
      if (query_time == 0) timesText.setText(""); // howtoString?
      else if (query_time == 1) timesText.setText(query_time + " time "); // howtoString?
      else timesText.setText(query_time + " times");

      // Fill the icons we don't have Icons for buildings in DB yet
      ImageView imageView = (ImageView) itemView.findViewById(R.id.item_icon);
      imageView.setImageResource(currentBuilding.getBuildingIcon()); // int
      // bi_1=0x7f020000;

      return itemView;
    }
Ejemplo n.º 2
0
 private void getBuildingList() {
   for (DB_Building tmp : value) {
     buildingList.add(tmp.getBuildingName());
   }
 }