Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Dúvida no Ex. 9 da Aula 5 - Persistência com SQLite

Meu projeto executa normalmente, consigo ir para o formulário de cadastro, mas ao clicar no botão para gravar o projeto da erro e nem consigo mais executar. Obs.: Após o erro preciso limpar os dados do aplicativo para que ele volte a abrir.

5 respostas

Ola Flávio, bom dia !

Você poderia colocar o erro que é gerado aqui para gente ver ?

Abraços

Matheus

Onde posso pegar o Log de erros? pois no emulador só aparece "o aplicativo parou"

Quando o emulador apresenta essa informação um exception é lançada e pode ser vista no logCat.

10-06 21:13:06.969: I/art(28662): Late-enabling -Xcheck:jni 10-06 21:13:08.009: D/OpenGLRenderer(28662): Use EGL_SWAP_BEHAVIOR_PRESERVED: true 10-06 21:13:08.029: D/Atlas(28662): Validating map... 10-06 21:13:08.257: I/Adreno-EGL(28662): : EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.016_msm8226_LA.BF.1.1.1_RB1__release_AU () 10-06 21:13:08.257: I/Adreno-EGL(28662): OpenGL ES Shader Compiler Version: E031.25.03.00 10-06 21:13:08.257: I/Adreno-EGL(28662): Build Date: 02/11/15 Wed 10-06 21:13:08.257: I/Adreno-EGL(28662): Local Branch: 10-06 21:13:08.257: I/Adreno-EGL(28662): Remote Branch: quic/LA.BF.1.1.1_rb1.10 10-06 21:13:08.257: I/Adreno-EGL(28662): Local Patches: NONE 10-06 21:13:08.257: I/Adreno-EGL(28662): Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.016 + 62ca4eb + acd831d + 9f8b442 + e027a02 + cba30ba + 53c303a + a649d79 + 23e16f8 + 5e97da7 + cbd2a44 + 33d072a + 7aacf06 + 72b33e7 + 28f6f60 + b4c13d8 + NOTHING 10-06 21:13:08.263: I/OpenGLRenderer(28662): Initialized EGL, version 1.4 10-06 21:13:08.343: D/OpenGLRenderer(28662): Enabling debug mode 0 10-06 21:13:37.507: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:37.507: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:37.509: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:37.509: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:37.531: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:37.531: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:47.392: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:47.393: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:47.399: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:47.399: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:50.759: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:50.759: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:52.036: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:52.036: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:52.039: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:52.039: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:55.312: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:55.312: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:56.577: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:56.577: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:56.592: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:13:56.592: E/SpannableStringBuilder(28662): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-06 21:14:02.280: E/CursorWindow(28662): Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 7 columns. 10-06 21:14:02.282: D/AndroidRuntime(28662): Shutting down VM 10-06 21:14:02.282: D/AndroidRuntime(28662): --------- beginning of crash 10-06 21:14:02.287: E/AndroidRuntime(28662): FATAL EXCEPTION: main 10-06 21:14:02.287: E/AndroidRuntime(28662): Process: br.com.caelum.cadastro, PID: 28662 10-06 21:14:02.287: E/AndroidRuntime(28662): java.lang.RuntimeException: Unable to resume activity {br.com.caelum.cadastro/br.com.caelum.cadastro.ListaAlunosActivity}: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3028) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.os.Handler.dispatchMessage(Handler.java:102) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.os.Looper.loop(Looper.java:135) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.ActivityThread.main(ActivityThread.java:5343) 10-06 21:14:02.287: E/AndroidRuntime(28662): at java.lang.reflect.Method.invoke(Native Method) 10-06 21:14:02.287: E/AndroidRuntime(28662): at java.lang.reflect.Method.invoke(Method.java:372) 10-06 21:14:02.287: E/AndroidRuntime(28662): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 10-06 21:14:02.287: E/AndroidRuntime(28662): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) 10-06 21:14:02.287: E/AndroidRuntime(28662): Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.database.CursorWindow.nativeGetString(Native Method) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.database.CursorWindow.getString(CursorWindow.java:438) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51) 10-06 21:14:02.287: E/AndroidRuntime(28662): at br.com.caelum.cadastro.dao.AlunoDAO.getLista(AlunoDAO.java:76) 10-06 21:14:02.287: E/AndroidRuntime(28662): at br.com.caelum.cadastro.ListaAlunosActivity.onResume(ListaAlunosActivity.java:60) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.Activity.performResume(Activity.java:6096) 10-06 21:14:02.287: E/AndroidRuntime(28662): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011) 10-06 21:14:02.287: E/AndroidRuntime(28662): ... 9 more 10-06 21:14:06.389: I/Process(28662): Sending signal. PID: 28662 SIG: 9

solução!

Encontrei o erro na minha classe AlunoDAO. Obrigado!