android连接数据库时出现闪退现象

原创 2018年04月16日 14:32:57
源码:
String sql= "select totalmoney from myaccount where username=?"; Cursor c = read.rawQuery(sql,new String[]{"dzy"}); if(c.moveToFirst()){ } else { AlertDialog.Builder diogal = new AlertDialog.Builder(account.this); final View view1 = LayoutInflater.from(account.this).inflate(R.layout.totalmoney_iteam,null); diogal.setView(view1); diogal.setTitle("总金额").setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { EditText money = (EditText)findViewById(R.id.totalmoney); String mon = money.getText().toString(); String sql = "insert into dzy (totalmoney)values(?)"; write.execSQL(sql,new String[]{mon}); } }).show(); }
logcat:04-16 06:28:07.236 5655-5655/? I/zygote: Not late-enabling -Xcheck:jni (already on) 04-16 06:28:07.287 5655-5655/? W/zygote: Unexpected CPU variant for X86 using defaults: x86 04-16 06:28:07.730 5655-5678/com.example.mathi.myapplication1 D/OpenGLRenderer: HWUI GL Pipeline 04-16 06:28:07.778 5655-5655/com.example.mathi.myapplication1 D/android.widget.GridLayout: vertical constraints: y3-y0>=1859, y3-y2<=238, y2-y1<=239, y1-y0<=239 are inconsistent; permanently removing: y3-y2<=238. 04-16 06:28:07.872 5655-5678/com.example.mathi.myapplication1 I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 04-16 06:28:07.873 5655-5678/com.example.mathi.myapplication1 I/OpenGLRenderer: Initialized EGL, version 1.4 04-16 06:28:07.873 5655-5678/com.example.mathi.myapplication1 D/OpenGLRenderer: Swap behavior 1 04-16 06:28:07.874 5655-5678/com.example.mathi.myapplication1 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 04-16 06:28:07.874 5655-5678/com.example.mathi.myapplication1 D/OpenGLRenderer: Swap behavior 0 04-16 06:28:07.928 5655-5678/com.example.mathi.myapplication1 D/EGL_emulation: eglCreateContext: 0xe8b8d920: maj 2 min 0 rcv 2 04-16 06:28:08.030 5655-5678/com.example.mathi.myapplication1 D/EGL_emulation: eglMakeCurrent: 0xe8b8d920: ver 2 0 (tinfo 0xe8b9b9f0) 04-16 06:28:08.099 5655-5678/com.example.mathi.myapplication1 D/EGL_emulation: eglMakeCurrent: 0xe8b8d920: ver 2 0 (tinfo 0xe8b9b9f0) 04-16 06:28:08.366 5655-5655/com.example.mathi.myapplication1 V/View: dispatchProvideAutofillStructure(): not laid out, ignoring 0 children of 1073741835 04-16 06:28:08.372 5655-5655/com.example.mathi.myapplication1 I/AssistStructure: Flattened final assist data: 3436 bytes, containing 1 windows, 13 views 04-16 06:28:18.269 5655-5661/com.example.mathi.myapplication1 I/zygote: Do partial code cache collection, code=24KB, data=30KB 04-16 06:28:18.269 5655-5661/com.example.mathi.myapplication1 I/zygote: After code cache collection, code=24KB, data=30KB 04-16 06:28:18.270 5655-5661/com.example.mathi.myapplication1 I/zygote: Increasing code cache capacity to 128KB 04-16 06:28:19.459 5655-5661/com.example.mathi.myapplication1 I/zygote: Do partial code cache collection, code=61KB, data=61KB 04-16 06:28:19.461 5655-5661/com.example.mathi.myapplication1 I/zygote: After code cache collection, code=61KB, data=61KB 04-16 06:28:19.461 5655-5661/com.example.mathi.myapplication1 I/zygote: Increasing code cache capacity to 256KB 04-16 06:28:21.850 5655-5661/com.example.mathi.myapplication1 I/zygote: Do full code cache collection, code=123KB, data=103KB 04-16 06:28:21.850 5655-5661/com.example.mathi.myapplication1 I/zygote: After code cache collection, code=121KB, data=79KB 04-16 06:28:21.892 5655-5678/com.example.mathi.myapplication1 D/EGL_emulation: eglMakeCurrent: 0xe8b8d920: ver 2 0 (tinfo 0xe8b9b9f0) 04-16 06:28:21.908 5655-5678/com.example.mathi.myapplication1 D/EGL_emulation: eglMakeCurrent: 0xe8b8d920: ver 2 0 (tinfo 0xe8b9b9f0) 04-16 06:28:21.942 5655-5655/com.example.mathi.myapplication1 E/SQLiteLog: (1) no such table: myaccount 04-16 06:28:21.943 5655-5655/com.example.mathi.myapplication1 D/AndroidRuntime: Shutting down VM 04-16 06:28:21.944 5655-5655/com.example.mathi.myapplication1 E/AndroidRuntime: FATAL EXCEPTION: main                                                                                 Process: com.example.mathi.myapplication1, PID: 5655                                                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mathi.myapplication1/com.example.mathi.myapplication1.account}: android.database.sqlite.SQLiteException: no such table: myaccount (code 1): , while compiling: select totalmoney from myaccount where username=?                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)                                                                                     at android.app.ActivityThread.-wrap11(Unknown Source:0)                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)                                                                                     at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                     at android.os.Looper.loop(Looper.java:164)                                                                                     at android.app.ActivityThread.main(ActivityThread.java:6494)                                                                                     at java.lang.reflect.Method.invoke(Native Method)                                                                                     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)                                                                                  Caused by: android.database.sqlite.SQLiteException: no such table: myaccount (code 1): , while compiling: select totalmoney from myaccount where username=?                                                                                     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)                                                                                     at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)                                                                                     at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:501)                                                                                     at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)                                                                                     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)                                                                                     at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)                                                                                     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)                                                                                     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1392)                                                                                     at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1331)                                                                                     at com.example.mathi.myapplication1.account.diolog(account.java:34)                                                                                     at com.example.mathi.myapplication1.account.onCreate(account.java:25)                                                                                     at android.app.Activity.performCreate(Activity.java:7009)                                                                                     at android.app.Activity.performCreate(Activity.java:7000)                                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)                                                                                      at android.app.ActivityThread.-wrap11(Unknown Source:0)                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)                                                                                      at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                      at android.os.Looper.loop(Looper.java:164)                                                                                      at android.app.ActivityThread.main(ActivityThread.java:6494)                                                                                      at java.lang.reflect.Method.invoke(Native Method)                                                                                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  04-16 06:28:21.946 5655-5661/com.example.mathi.myapplication1 I/zygote: Do partial code cache collection, code=122KB, data=86KB 04-16 06:28:21.948 5655-5661/com.example.mathi.myapplication1 I/zygote: After code cache collection, code=122KB, data=86KB 04-16 06:28:21.948 5655-5661/com.example.mathi.myapplication1 I/zygote: Increasing code cache capacity to 512KB

赵强老师:Oracle数据库从10g到11g(16)闪回

从零开始学习Oracle数据库,从10g讲到11g;让学员读整个Oracle数据库有个全面清除的认识和学习。
  • 2018年04月07日 08:37

为什么AndroidStudio3.0 APP下载到手机打不开 闪退

刚学了AS没有多久,自己买了视频学习的,店家有群和技术支持。不过是上一个版本2.3的。     将进入AS默认APP(HolleWord)下载到手机就出现了问题。下载之后怎么都打不开,闪退,下面说一...
  • CSDN_X_W
  • CSDN_X_W
  • 2018-01-31 21:22:28
  • 98

android开发时遇到闪退的原因

在用Eclipse做android开发室,经常会遇到程序闪退的情况,目前我遇到的有两种情况...
  • u014672511
  • u014672511
  • 2014-06-14 01:18:37
  • 1070

Android开发时处理闪退问题的方法

就是记录闪退时的异常了! 1 全局异常捕获处理类package com.example.admin.myandroidtest; import android.content.Context; i...
  • jinsedeme0881
  • jinsedeme0881
  • 2018-01-11 17:18:34
  • 482

mysql控制台闪退

https://jingyan.baidu.com/article/b7001fe1699f800e7282ddb8.html
  • huawei12341
  • huawei12341
  • 2017-11-18 10:40:44
  • 173

android studio2.3闪退问题

app在部分手机上(低版本)打不开或打开就闪退的问题:问题描述1.之前做过一个环信的即时通讯,集成好环信的sdk之后在4.x的手机上就打开就闪退,,只能在5.x和6.x手机上打开app 2.最近...
  • liuxiangying_1987
  • liuxiangying_1987
  • 2017-04-19 23:04:35
  • 629

JAVA Eclipse开发Android程序会经常闪退是怎么回事

类没有new就直接用会闪退,比如下面我在前面声明了ClientSocket的类,点击连接按钮之后,如果不先new就直接Connect就会闪退  你在当前页面创建findViewById的...
  • acetaohai123123
  • acetaohai123123
  • 2017-10-17 21:59:15
  • 635

Xcode闪退的问题

最近上传APP遇到了Xcode闪退的问题。每次提交当进度条走完的那一瞬间就闪退报错误。 1。刚开始就以为是自己项目有问题,...
  • u010871761
  • u010871761
  • 2015-06-25 15:29:13
  • 372

Android Studio 突然闪退

Android Studio有时用着突然闪退, 用终端启动后发现报的错是 'MaxPermSize=256m',去studio64.vmoptions把那句注掉就行了。 ...
  • xiangwei132
  • xiangwei132
  • 2017-02-14 21:38:33
  • 146

android studio生成的apk闪退问题

android studio生成的apk闪退问题     前一段时间做项目比较忙,没时间更新博客,现在忙完了,对做项目的过程中遇到的问题做个总结。首先就是从android studio 生成的安...
  • shixingyi_66
  • shixingyi_66
  • 2017-08-06 13:01:11
  • 5923
收藏助手
不良信息举报
您举报文章:android连接数据库时出现闪退现象
举报原因:
原因补充:

(最多只允许输入30个字)