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

Persistência SQLite

Estou desenvolvendo um projeto para a Faculdade a partir das vídeo aulas, e estou com um problema para exibir o dados.

Segue o log.. Obrigado galera. o/

11-01 18:53:39.362: E/AndroidRuntime(622): FATAL EXCEPTION: main 11-01 18:53:39.362: E/AndroidRuntime(622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sualista/com.example.sualista.SuaLista}: android.database.sqlite.SQLiteException: no such column: nome (code 1): , while compiling: SELECT id, nome, quantidade, preco FROM Produtos 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread.access$600(ActivityThread.java:130) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.os.Handler.dispatchMessage(Handler.java:99) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.os.Looper.loop(Looper.java:137) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread.main(ActivityThread.java:4745) 11-01 18:53:39.362: E/AndroidRuntime(622): at java.lang.reflect.Method.invokeNative(Native Method) 11-01 18:53:39.362: E/AndroidRuntime(622): at java.lang.reflect.Method.invoke(Method.java:511) 11-01 18:53:39.362: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 11-01 18:53:39.362: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 11-01 18:53:39.362: E/AndroidRuntime(622): at dalvik.system.NativeStart.main(Native Method) 11-01 18:53:39.362: E/AndroidRuntime(622): Caused by: android.database.sqlite.SQLiteException: no such column: nome (code 1): , while compiling: SELECT id, nome, quantidade, preco FROM Produtos 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200) 11-01 18:53:39.362: E/AndroidRuntime(622): at com.sualista.DAO.ProdutoDAO.getLista(ProdutoDAO.java:61) 11-01 18:53:39.362: E/AndroidRuntime(622): at com.example.sualista.SuaLista.onCreate(SuaLista.java:29) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.Activity.performCreate(Activity.java:5008) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 11-01 18:53:39.362: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 11-01 18:53:39.362: E/AndroidRuntime(622): ... 11 more

2 respostas
solução!

Manda a sua classe ProdutoDAO, provavelmente o erro está nela.

Opa, consegui arrumar.. Mudei a versão do banco e o nome da tabela. Obrigado por responder.