public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.suggestion, null); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.suggestion_app_icon); holder.txtName = (TextView) convertView.findViewById(R.id.actionName); holder.txtType = (TextView) convertView.findViewById(R.id.suggestion_type); holder.txtBenefit = (TextView) convertView.findViewById(R.id.expectedBenefit); holder.moreInfo = (ImageView) convertView.findViewById(R.id.jscore_info); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (indexes == null || position < 0 || position >= indexes.length) return convertView; SimpleHogBug item = indexes[position]; if (item == null) return convertView; final String raw = item.getAppName(); Drawable icon = CaratApplication.iconForApp(a.getApplicationContext(), raw); if (raw.equals(FAKE_ITEM)) { holder.txtName.setText(a.getString(R.string.osupgrade)); holder.txtType.setText(a.getString(R.string.information)); holder.txtBenefit.setText(a.getString(R.string.unknown)); } else { String label = CaratApplication.labelForApp(a.getApplicationContext(), raw); if (label == null) label = a.getString(R.string.unknown); holder.icon.setImageDrawable(icon); Constants.Type type = item.getType(); if (type == Constants.Type.BUG) holder.txtName.setText(a.getString(R.string.restart) + " " + label); else if (type == Constants.Type.HOG) holder.txtName.setText(a.getString(R.string.kill) + " " + label); else { // Other action holder.txtName.setText(label); } if (type == Constants.Type.OTHER) holder.txtType.setText(item.getAppPriority()); else holder.txtType.setText(CaratApplication.translatedPriority(item.getAppPriority())); /*if (raw.equals(a.getString(R.string.disablebluetooth))){ double benefitOther=SamplingLibrary.bluetoothBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min= (int) ((benefitOther- hours)*60); } else if(raw.equals(a.getString(R.string.disablewifi))){ double benefitOther=SamplingLibrary.wifiBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min= (int) ((benefitOther- hours)*60); } else if(raw.equals(a.getString(R.string.dimscreen))){ double benefitOther=SamplingLibrary.screenBrightnessBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min = (int) ((benefitOther- hours)*60); }*/ // Do not show a benefit for things that have none. if (item.getExpectedValue() == 0 && item.getExpectedValueWithout() == 0) { holder.txtBenefit.setText(""); TextView bl = (TextView) convertView.findViewById(R.id.benefitLegend); bl.setText(""); } else holder.txtBenefit.setText(item.getBenefitText()); // holder.moreInfo... } // } return convertView; }