Showing posts with label Comparing Double NOT string value in SQLite. Show all posts
Showing posts with label Comparing Double NOT string value in SQLite. Show all posts

Wednesday, April 24, 2013

[android help] Comparing Double NOT string value in SQLite


I am trying to compare latitude and longitude values in sqlite via Android using a BETWEEN operator. The problem is that the value is always compared as if it's a String and I can't figure out how to compare it as a number. I found this out because using the query "select * from database orderby latitude" returns a list that is not quite ordered since it is not ordered by value. KEY_LAT and KEY_LONG I have stored as both TEXT and REAL, and I get the same output. Please tell me what info you need.


Here is the query:



double high_lat = curr_lat + 100.0;
double high_long = curr_longitude + 100.0;
double low_lat = curr_lat - 100.0;
double low_long = curr_longitude - 100.0;
Cursor cursor = db.query(TABLE_NAME, new String[] {KEY_ID, KEY_NAME, KEY_ADDR, KEY_LAT, KEY_LONG}, select,
new String[]
{KEY_LAT + " BETWEEN " + low_lat + " AND "
+ high_lat + " AND " + KEY_LONG + " BETWEEN " + low_long + " AND "
+ high_long},
null, null, null);


.

stackoverflow.comm

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...