Ошибка: ArrayAdapter требует, чтобы идентификатор ресурса был TextView

Что это значит? Я боролся с этим ListView , который я использовал с помощью ArrayAdapter . Я написал этот красивый фрагмент диалога, который я перезвонил списку updateUI, потому что я хочу обновить этот ListView , который есть в моем фрагменте из DialogFragment сначала ArrayAdapter был сложным типом класса i Создано:

ArrayAdapter<Location> theLocations;
...
//in oncreateview
theLocations = new ArrayAdapter<Location>(mContext, R.layout.location_row, locations);
//here locations is an ArrayList<Location>

тогда у меня есть:

public void onUIUpdate(Location l) { //called from dialog fragment      
 locations.add(l);                  
 theLocations.notifyDataSetChanged();       
}

, это дало указанную выше ошибку, поэтому я переключил его на использование только

String[] locationNames = new String[sizeofLocations];
theLocations=new ArrayAdapter<String>(mContext, R.layout.location_Row, locationNames );

public void onUIUpdate(Location l) {        
    locations.add(l);                   
            locationNames = new String[locations.size()];
            for(locations.size() etc...) { 
               locationNames [i] = new String(locations.get(i).getName());
            }
    theLocations.notifyDataSetChanged();        
}

. Это не ошибка в моем методе обновления (который обновляет пользовательский интерфейс), но ничего не обновлял. Так что я не понимаю, как обновить этот ArrayAdapter, я думал, что notifyChange должен это сделать, но он либо ничего не делает, либо выдает указанную выше ошибку.

У меня нет проблем с моими SimpleCursorAdapter где-либо еще в моей программе (пока мои курсоры остаются открытыми, и я вызываю к ним запрос).

Есть ли какие-либо сведения о том, что я делаю неправильно?

По запросу вот мой макет для R.layout.location_row

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="fill_parent"     android:orientation="horizontal">   
<TextView android:text="@+id/TextView01" android:layout_height="wrap_content" android:id="@+id/location_name"
    android:textSize="15px" android:layout_marginTop="10px" android:layout_width="wrap_content"></TextView>
<TextView android:text="|" android:layout_height="wrap_content" 
    android:textSize="15px" android:layout_marginTop="6px" android:layout_width="wrap_content"></TextView>
<TextView android:text="@+id/TextView01" android:layout_height="wrap_content" android:id="@+id/location_lat"
    android:textSize="15px" android:layout_marginTop="6px" android:layout_width="wrap_content"></TextView>
<TextView android:text="|$" android:layout_height="wrap_content" 
    android:textSize="15px" android:layout_marginTop="6px" android:layout_width="wrap_content"></TextView>  
<TextView android:text="@+id/TextView01" android:layout_height="wrap_content" android:id="@+id/location_lon"
    android:textSize="15px" android:layout_marginTop="6px" android:layout_width="wrap_content"></TextView>
</LinearLayout> 
8
задан Codejoy 25 July 2011 в 22:05
поделиться