androidsearchmatrixcursor

NumberFormatException at MatrixCursor column for searching in maps from database


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?


Solution

  • OK, sounds similar to the exception retrived when using geocoder on the emulator in SDK 8. my guess its another emulator bug related to the geocoder clas try this on a real device, or lower the SDK version on the emulator - Should do the trick.