我正在开发一个一次最多保存 30 条记录的应用程序,当我减少到 10 条记录时,我可以访问活动并保存记录,但是如果我添加代码以保存更多记录,则应用程序崩溃。
下面是我的代码
case R.id.BSaveAll:
boolean diditworkAll = true;
try {
String observe1 = Observation1.getText().toString();
String observe2 = Observation2.getText().toString();
String observe3 = Observation3.getText().toString();
String observe4 = Observation4.getText().toString();
String observe5 = Observation5.getText().toString();
String observe6 = Observation6.getText().toString();
String observe7 = Observation7.getText().toString();
String observe8 = Observation8.getText().toString();
String observe9 = Observation9.getText().toString();
String observe10 = Observation10.getText().toString();
String observe11 = Observation11.getText().toString();
String observe12 = Observation12.getText().toString();
String observe13 = Observation13.getText().toString();
String observe14 = Observation14.getText().toString();
String observe15 = Observation15.getText().toString();
DBContractor con1 = new DBContractor(this);
con1.open();
String lastid1 = con1.getConstructorId();
con1.close();
String construct1 = lastid1;
BitmapDrawable bitmapDrawable11 = (BitmapDrawable) view1_1
.getDrawable();
Bitmap bitmap11 = bitmapDrawable11.getBitmap();
byte[] image1_1 = DBManagement.getBytes(bitmap11);
BitmapDrawable bitmapDrawable12 = (BitmapDrawable) view1_2
.getDrawable();
Bitmap bitmap12 = bitmapDrawable12.getBitmap();
byte[] image1_2 = DBManagement.getBytes(bitmap12);
BitmapDrawable bitmapDrawable13 = (BitmapDrawable) view1_3
.getDrawable();
Bitmap bitmap13 = bitmapDrawable13.getBitmap();
byte[] image1_3 = DBManagement.getBytes(bitmap13);
BitmapDrawable bitmapDrawable14 = (BitmapDrawable) view1_4
.getDrawable();
Bitmap bitmap14 = bitmapDrawable14.getBitmap();
byte[] image1_4 = DBManagement.getBytes(bitmap14);
BitmapDrawable bitmapDrawable15 = (BitmapDrawable) view1_5
.getDrawable();
Bitmap bitmap15 = bitmapDrawable15.getBitmap();
byte[] image1_5 = DBManagement.getBytes(bitmap15);
DBManagement entry1 = new DBManagement(this);
entry1.open();
entry1.createEntry1(title1, Possible1, Achieved1, observe1,
image1_1, image1_2, image1_3, image1_4, image1_5,
construct1);
entry1.close();
DBContractor con2 = new DBContractor(this);
con2.open();
String lastid2 = con2.getConstructorId();
con2.close();
String construct2 = lastid2;
BitmapDrawable bitmapDrawable21 = (BitmapDrawable) view2_1
.getDrawable();
Bitmap bitmap21 = bitmapDrawable21.getBitmap();
byte[] image2_1 = DBManagement.getBytes(bitmap21);
BitmapDrawable bitmapDrawable22 = (BitmapDrawable) view2_2
.getDrawable();
Bitmap bitmap22 = bitmapDrawable22.getBitmap();
byte[] image2_2 = DBManagement.getBytes(bitmap22);
BitmapDrawable bitmapDrawable23 = (BitmapDrawable) view2_3
.getDrawable();
Bitmap bitmap23 = bitmapDrawable23.getBitmap();
byte[] image2_3 = DBManagement.getBytes(bitmap23);
BitmapDrawable bitmapDrawable24 = (BitmapDrawable) view2_4
.getDrawable();
Bitmap bitmap24 = bitmapDrawable24.getBitmap();
byte[] image2_4 = DBManagement.getBytes(bitmap24);
BitmapDrawable bitmapDrawable25 = (BitmapDrawable) view2_5
.getDrawable();
Bitmap bitmap25 = bitmapDrawable25.getBitmap();
byte[] image2_5 = DBManagement.getBytes(bitmap25);
DBManagement entry2 = new DBManagement(this);
entry2.open();
entry2.createEntry2(title2, Possible2, Achieved2, observe2,
image2_1, image2_2, image2_3, image2_4, image2_5,
construct2);
entry2.close();
} catch (Exception e) {
// TODO: handle exception
diditworkAll = false;
Toast.makeText(this, "Failed,please try again",
Toast.LENGTH_LONG).show();
} finally {
if (diditworkAll) {
Toast.makeText(this, "Successfull,proceed to Appointment",
Toast.LENGTH_LONG).show();
}
}
break;`
05-13 18:44:40.536: W/dalvikvm(431): VFY: arbitrarily rejecting large method (regs=365 count=8384)
05-13 18:44:40.536: W/dalvikvm(431): VFY: rejected Lcom/example/mba_north/Management;.onClick (Landroid/view/View;)V
05-13 18:44:40.546: W/dalvikvm(431): Verifier rejected class Lcom/example/mba_north/Management;
05-13 18:44:40.556: W/dalvikvm(431): Class init failed in newInstance call (Lcom/example/mba_north/Management;)
05-13 18:44:40.556: D/AndroidRuntime(431): Shutting down VM
05-13 18:44:40.556: W/dalvikvm(431): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-13 18:44:40.586: E/AndroidRuntime(431): FATAL EXCEPTION: main
05-13 18:44:40.586: E/AndroidRuntime(431): java.lang.VerifyError: com.example.mba_north.Management
05-13 18:44:40.586: E/AndroidRuntime(431): at java.lang.Class.newInstanceImpl(Native Method)
05-13 18:44:40.586: E/AndroidRuntime(431): at java.lang.Class.newInstance(Class.java:1429)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
05-13 18:44:40.586: E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-13 18:44:40.586: E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 18:44:40.586: E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:521)
05-13 18:44:40.586: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-13 18:44:40.586: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-13 18:44:40.586: E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)