out of memory double update sqlite android
Well im a beginner and this is my first android app, and i get this problem
Failure 21 "Out of memory" on 0x0 when preparing 'update clients set lat=19.124566,lng=-103.23546 where id=1'
In my table structure i set lat and lng as DOUBLE.
I read about it and some people say the SD card needs to be bigger, but then I set the SD card of the emulator to 5Gb, I'm using android 1.6 hope you can help me. thanks =D
soome code here.
try {
dir1 = new Geocoder(this).getFromLocationName(dir_1, 1);
Address address = dir1.get(0);
if(address.hasLatitude() && address.hasLongitude()){
double selectedLat = address.getLatitude();
double selectedLng = address.getLongitude();
adapter.command("UPDATE clientes set lat_1="+selectedLat*1000000+",lng_1="+selectedLng*1000000+" WHERE id="+idCliente);
开发者_C百科 Log.e("geo","location1: "+selectedLat+" : "+selectedLng);
}
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("error","Error en la direccion 1");
e.printStackTrace();
}
It appears that this error message is misleading and might have nothing to do with storage space or memory. This post suggests it occurs when you have an error in your SQL.
Without seeing some of your code, it is hard to give more specific suggestions. Can you post some?
So im guessing your command method just puts that string into an execSql() method. You will need to append the semi-colon within the string to execute, so:
adapter.command("UPDATE clientes set lat_1="+selectedLat*1000000+",lng_1="+selectedLng*1000000+" WHERE id="+idCliente+";");
精彩评论