1
int columnIndexFromAddrCountry;
public FavoritesActAdapter(Context context, int layout,
Cursor c, String[] from, int[] to) {
super(context, layout, c, from, to);
gnCursor = c;
columnIndexFromAddrCountry =
c.getColumnIndex(DBAdapter.KEY_FROM_ADDR_COUNTRY);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
gnCursor = getCursor();
final String fromAddrCountry =
gnCursor.getString(columnIndexFromAddrCountry);
...
super.bindView(view, context, cursor);
}
爲什麼我會收到IllegalStateException
?IllegalStateException:從第0行獲取字段插槽col -1失敗
IllegalStateException異常:從0行山坳-1得到磁場槽 失敗
是什麼異常是什麼意思?唯一的例外是拋出此行
final String fromAddrCountry = gnCursor.getString(columnIndexFromAddrCountry);
因爲columnIndexFromAddrCountry
是-1
。 該列存在,其他十列可以解析。什麼會導致這個問題?
在此先感謝!
`DBAdapter.KEY_FROM_ADDR_COUNTRY`是一個公共靜態String,它表示列的名稱。相同的字符串用於創建表。 – 2011-01-26 22:19:34