内存不足,双重更新sqlite android

问题描述

| 好吧,我是一个初学者,这是我的第一个android应用程序,我遇到了这个问题
Failure 21 \"Out of memory\" on 0x0 when preparing \'update clients set lat=19.124566,lng=-103.23546 where id=1\'
在我的表格结构中,我将lat和lng设置为DOUBLE。 我读到它,有人说SD卡需要更大,但是后来我将模拟器的SD卡设置为5Gb,我正在使用android 1.6希望您能对我有所帮助。谢谢= D 这里的代码
    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);                                              
                Log.e(\"geo\",\"location1: \"+selectedLat+\" : \"+selectedLng);
            }
    } catch (IOException e) {
        // Todo Auto-generated catch block
        Log.e(\"error\",\"Error en la direccion 1\");
        e.printstacktrace();
    }
    

解决方法

        似乎该错误消息具有误导性,并且可能与存储空间或内存无关。这篇文章建议当您的SQL错误时发生。 如果看不到您的某些代码,很难给出更具体的建议。你可以张贴一些吗?     ,        所以我猜你的命令方法只是将字符串放入execSql()方法。 您将需要在字符串中附加分号来执行,因此:
adapter.command(\"UPDATE clientes set lat_1=\"+selectedLat*1000000+\",lng_1=\"+selectedLng*1000000+\" WHERE id=\"+idCliente+\";\");