tags:

views:

13

answers:

1

Friend's I'm using searching in my map search from database content using MatrixCursor,here i'm NumberFormat Exception in Android sdk version 2.2, Here my code looks like

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 has follows

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

here the exception i'm getting like

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)

what the reason for getting this problem,how can i fix this issue.

A: 

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.

Jason
When i use SDK 8 even in device and on emulator at that time only i'm getting this problem if i use less than 8 even in real time device i'm not getting like this problem,it is working good,please help me what can i do further.how can i fix this problem,help me.it's urgent.
MGS
Yes, that is what I said it is a emultor bug, It should work fine on a real device. For testing purposes on PC you could use lower SDK version. A bit of a pain in the A** but nothing to do about it.
Jason
I checked it on real time device sdk 8 still it'd getting same problem.
MGS
Hmm then possibly a bug in 2.2? I hope not sorry I had a similar problem but resolved it as a 2.2 emulator bug. And i have not tested on a 2.2 device yet so I hope it realy is an emulator bug. Maybe consider a different way to do what your are trying to do? possibly threw google API for geocoding on the web?
Jason
what version of map api you used..i'm using map 1.6
MGS
I am using 1.6 as well. however as I said haven't tested it on a real device. Possibly you could try a new API and see if that helps, But since it only stops working in 2.2 I would figure its more likely to be a 2.2 bug. One thing that should work for sure is using The 2.2 API for maps.
Jason