as you can see from the code below im just trying to get the coords pushed out to the logcat. however i never see the message or the coords. it shows me the sql string then finishes. so i believe the try is failing but even the catch statement doesnt return anything.
Button ButtonMap = (Button) findViewById(R.id.ButMap);
ButtonMap.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
/* Query for some results with Selection and Projection. */
String sql = "SELECT _id,Longitude,Latitude FROM " + MY_DATABASE_TABLE + " WHERE _id = "+ID;
Cursor c = db.rawQuery(sql,null);
//db.query(MY_DATABASE_TABLE, new String[] {"_id", "Longitude", "Latitude"},
// "_id = " + "'%"+ID+"%'", null, null, null, null);
Log.e("SQL Select", sql);
/* Get the indices of the Columns we will need */
int longitude, latitude ;
longitude = c.getColumnIndex("Longitude");
latitude = c.getColumnIndex("Latitude");
/* Check if our result was valid. */
if (c.moveToFirst()) {
int i = 0;
/* Loop through all Results */
do {
i++;
/* Retrieve the values of the Entry
* the Cursor is pointing to. */
double lat = c.getDouble(latitude);
double lon = c.getDouble(longitude);
Log.e("GPS", "location for this record is: lat="+lat+", lon="+lon);
} while (c.moveToNext());
}
} catch (Throwable t) {
Log.e("GPS", t.toString());
}
finally {
if (db != null)
db.close();
}
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
}
been to long to know exactly what fixed it but here is the answer code: