Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android SQLite在模拟器中崩溃,但不是手机?_Android_Android Emulator_Android Sqlite - Fatal编程技术网

Android SQLite在模拟器中崩溃,但不是手机?

Android SQLite在模拟器中崩溃,但不是手机?,android,android-emulator,android-sqlite,Android,Android Emulator,Android Sqlite,我遇到了一个有趣的问题,我的代码在手机上运行得很好,但在模拟器上运行时,当应用程序试图从数据库中获取值时,我就会崩溃 下面是正在使其崩溃的DB Helper函数 /** Used to retrieve our lowest stored val */ public int GetLowestVal(){ // Get our databases results Cursor result = null; try { // Get our databa

我遇到了一个有趣的问题,我的代码在手机上运行得很好,但在模拟器上运行时,当应用程序试图从数据库中获取值时,我就会崩溃

下面是正在使其崩溃的DB Helper函数

/** Used to retrieve our lowest stored val */
public int GetLowestVal(){

    // Get our databases results
    Cursor result = null;
    try { 
        // Get our databases results
        result = super.getAll();

    } catch( SQLException anyDbError ) { 
        // Errors? TODO
    } finally { 
        // Finally TODO
    }


    // Setup initial lowest val
    int lowestVal = 0;

    // Move through results and compare them
    while( result.moveToNext() ){
        // Get our place from the DB
        int index = Integer.parseInt(result.getString(1).trim());

        // Last index should be lowest
        if ( index == 10){
            lowestVal = Integer.parseInt(result.getString(3).trim());
        }   
    }

    // Return our value
    return lowestVal;

}
它抛出的错误是:

已递归调用getWriteableDatabase


对此很抱歉,问题是我试图在onCreate方法中编辑表,这会导致递归调用getWrteableDatabase


它在模拟器上不工作,但在手机上工作的原因是,在将任何内容添加到onCreate之前,数据库已在手机上创建,但在其他设备上部署它会导致崩溃。

请向我们显示完整的堆栈跟踪。对不起,您是指logcat输出吗?