n1 = (EditText) findViewById(R.id.num1);
int no1 = Integer.parseInt(n1.getText().toString());
n2 = (EditText) findViewById(R.id.num2);
int no2 = Integer.parseInt(n2.getText().toString());
message = (EditText) findViewById(R.id.message);
String msg = message.getText().toString();
settings.execSQL("CREATE TABLE IF NOT EXISTS settingtb(mob1 LONG,mob2 LONG,time VARCHAR,message VARCHAR(1000));");
settings.execSQL("INSERT INTO settingtb VALUES('" + no1 + "','" + no2
+ "'," + time + ",'" + msg + "');");
mob1、mob2 の値が 10 未満の場合、データがデータベースに挿入されます。値が 9 を超える場合、numberformat 例外が発生します。
ここに私のlogcatがあります
09-24 18:16:23.594: E/AndroidRuntime(1656): FATAL EXCEPTION: main
09-24 18:16:23.594: E/AndroidRuntime(1656): java.lang.NumberFormatException: Invalid int: "7842334531"
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.Integer.invalidInt(Integer.java:138)
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.Integer.parse(Integer.java:378)
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.Integer.parseInt(Integer.java:366)
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.Integer.parseInt(Integer.java:332)
09-24 18:16:23.594: E/AndroidRuntime(1656): at com.example.esha.settings.calltable(settings.java:87)
09-24 18:16:23.594: E/AndroidRuntime(1656): at com.example.esha.settings$1.onClick(settings.java:76)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.view.View.performClick(View.java:4084)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.view.View$PerformClick.run(View.java:16966)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.os.Handler.handleCallback(Handler.java:615)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.os.Handler.dispatchMessage(Handler.java:92)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.os.Looper.loop(Looper.java:137)
09-24 18:16:23.594: E/AndroidRuntime(1656): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.reflect.Method.invokeNative(Native Method)
09-24 18:16:23.594: E/AndroidRuntime(1656): at java.lang.reflect.Method.invoke(Method.java:511)
09-24 18:16:23.594: E/AndroidRuntime(1656): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-24 18:16:23.594: E/AndroidRuntime(1656): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-24 18:16:23.594: E/AndroidRuntime(1656): at dalvik.system.NativeStart.main(Native Method)