2010-11-27 59 views
1

我有這個代碼的問題。我修改ArrayAdapter的內容並將其作爲包含該數組的對象的參數進行排序。問題是修改視圖(是一個列表視圖)與不同的東西,圖標,改變背景等。事實是,通過使這種排序似乎混合了一些視圖的屬性。例如,背景已經擴散到移動因以及諸如此類的另一個問題:問題與視圖排序ArrayAdapter幾次

public class IconLVAdapter extends ArrayAdapter<Datos> { 

     private List<Datos> objetos; 
     private boolean online; 

     public IconLVAdapterBuses(Context context, int textViewResourceId, List<Datos> objetos, boolean online) { 
       super(context, textViewResourceId, objetos); 
       this.objetos = objetos; 
       this.online = online; 
     } 
     @Override 
     public View getView(int position, View convertView, ViewGroup parent) { 
       View v = convertView; 
       if (v == null) { 
        LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
        v = vi.inflate(R.layout.rowlist, null); 
       } 
       Datos o = objetos.get(position); 
       if (o != null) { 

         TextView tvNum = (TextView) v.findViewById(R.id.num); 

         if (o.getpOrigen()==null && tvNum!= null) 
          tvNum.setText(o.getnum()); 
         else{ 
             ************** omitido ************** 
         } 

       } 
       return v; 
     } 



     public void refreshArray(){ 
      this.sort(new Comparator<Datos>() { 
       public int compare(Datos object1, Datos object2) { 
        return object1.compareTo(object2); 
       }; 
      }); 
      this.notifyDataSetChanged(); 
     } 

任何想法?謝謝

回答