0

I'm using searching in my map search from database content using MatrixCursor. I have a NumberFormatException in Android SDK version 2.2. In my declaration I did:

private static final String[] COLUMNS = {

   _ID, // must include this column
   SearchManager.SUGGEST_COLUMN_TEXT_1,
   SearchManager.SUGGEST_COLUMN_INTENT_DATA };

and I also created the object for MatrixCursor that has:

MatrixCursor cursor = new MatrixCursor(COLUMNS);
cursor.addRow(columnValuesOfQuery(query, s));

Here is the exception I'm getting:

10-22 23:11:33.734: ERROR/SuggestionsAdapter(456): error changing cursor and caching columns
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456): java.lang.NumberFormatException: 
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456):     at java.lang.Long.parseLong(Long.java:347)
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456):     at java.lang.Long.parseLong(Long.java:320)
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456):     at android.database.MatrixCursor.getLong(MatrixCursor.java:255)
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456):     at android.database.CursorWrapper.getLong(CursorWrapper.java:127)
10-22 23:11:33.734: ERROR/SuggestionsAdapter(456):     at android.widget.CursorAdapter.getItemId(CursorAdapter.java:156)

Why I'm getting this exception and how can I fix it?

4

1 回答 1

0

好的,听起来类似于在 SDK 8 中的模拟器上使用地理编码器时检索到的异常。我猜它的另一个与地理编码器类相关的模拟器错误在真实设备上尝试这个,或者降低模拟器上的 SDK 版本 - 应该可以解决问题。

于 2010-10-22T18:11:21.710 回答