Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Cursor crash
    primarykey
    data
    text
    <p>i've searched on web and stackoverflow but couldnt find the solution i need. In my application, i record the accelerometer coordinate values to a database, and then when user clicks on the button it writes it to a file and generate some features for this coordinate values (like standart deviation,average,max,min etc. for the given time interval) finally, it writes this features to a file too. But when i ever tried to generate these features and write it to a file, it crashed and gave that out.</p> <pre class="lang-none prettyprint-override"><code>Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 1 columns. FATAL EXCEPTION: main java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetDouble(Native Method) at android.database.CursorWindow.getDouble(CursorWindow.java:543) at android.database.CursorWindow.getFloat(CursorWindow.java:594) at android.database.AbstractWindowedCursor.getFloat(AbstractWindowedCursor.java:81) at com.example.coordinates.MainActivity.generateFeatures(MainActivity.java:259) at com.example.coordinates.MainActivity.dosyayaYaz(MainActivity.java:239) at com.example.coordinates.MainActivity.onDialogPositiveClick(MainActivity.java:668) at com.example.coordinates.dialogFragement$1.onClick(dialogFragement.java:54) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>this is where i think i get error.</p> <pre><code>private void generateFeatures(String label){ boolean bitti=false; Cursor firstTimeHandler=db.rawQuery("SELECT MIN(zaman) FROM Koordinatlar", null); firstTimeHandler.moveToFirst(); float firstTime= firstTimeHandler.getFloat(firstTimeHandler.getColumnIndex("zaman")); float nextTime=firstTime+3000; Cursor lastTimeHandler=db.rawQuery("SELECT MAX(zaman) FROM Koordinatlar", null); lastTimeHandler.moveToFirst(); float lastTime=lastTimeHandler.getFloat(firstTimeHandler.getColumnIndex("zaman")); while(!bitti){ calculateAverage(firstTime,nextTime); calculateStandartDev(firstTime,nextTime); calculateAverageAbsoluteDifferance(firstTime,nextTime); calculateAverageResultant(firstTime,nextTime); calculateMax(firstTime,nextTime); firstTime=nextTime; nextTime=nextTime+3000; if(nextTime&gt;=lastTime){ nextTime=lastTime; calculateAverage(firstTime,nextTime); calculateStandartDev(firstTime,nextTime); calculateAverageAbsoluteDifferance(firstTime,nextTime); calculateAverageResultant(firstTime,nextTime); calculateMax(firstTime,nextTime); bitti=true; } } dosyayaYaz2(label); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload