我試圖使自定義列表視圖創建一個空對象引用
@Override
public View getView(int i, View view, ViewGroup parent) {
ViewHolder viewHolder;
if (view == null){
inflater = (LayoutInflater) context.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.cities_weather_detail, parent, false);
viewHolder = new ViewHolder();
viewHolder.cityName = (TextView) view.findViewById(R.id.city_name);
Data data = citiesData.get(i);
viewHolder.cityName.setText(data.getCity().getName());
view.setTag(viewHolder);
}
return view;
}
自定義列表視圖和錯誤試圖調用虛擬方法「布爾java.lang.String.equals(java.lang.Object中)」
當我嘗試訪問城市名稱viewHolder.cityname中的ID時,它正在破壞。
class ViewHolder{
TextView cityName;
//TextView temperature;
}