你好我正在制作一个加密和解密短信的安卓应用程序。我有一个问题,当短信的大小超过 80 个字符时,无法发送短信和应用程序。停止工作(给出错误)(少于 80 个字符没有错误,我可以发送 SMS)。我首先将消息转换为 byte( UTF-8
),然后使用getBytes()
.
这是 logcat 中的错误:
06-05 12:16:42.460: E/AndroidRuntime(333): java.lang.NullPointerException
06-05 12:16:42.460: E/AndroidRuntime(333):android.os.Parcel.readException(Parcel.java:1328)
06-05 12:16:42.460: E/AndroidRuntime(333):android.os.Parcel.readException(Parcel.java:1276)
06-05 12:16:42.460: E/AndroidRuntime(333):atcom.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:369)
06-05 12:16:42.460: E/AndroidRuntime(333):atandroid.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
06-05 12:16:42.460: E/AndroidRuntime(333):atcom.cryptosms.MainActivity.sendSMS(MainActivity.java:296)
06-05 12:16:42.460: E/AndroidRuntime(333):atcom.cryptosms.MainActivity$3.onClick(MainActivity.java:142)
06-05 12:16:42.460: E/AndroidRuntime(333):at android.view.View.performClick(View.java:2485)
06-05 12:16:42.460: E/AndroidRuntime(333):atandroid.view.View$PerformClick.run(View.java:9080)
06-05 12:16:42.460: E/AndroidRuntime(333): atandroid.os.Handler.handleCallback(Handler.java:587)
06-05 12:16:42.460: E/AndroidRuntime(333): atandroid.os.Handler.dispatchMessage(Handler.java:92)
06-05 12:16:42.460: E/AndroidRuntime(333): at android.os.Looper.loop(Looper.java:123)
06-05 12:16:42.460: E/AndroidRuntime(333): atandroid.app.ActivityThread.main(ActivityThread.java:3683)
06-05 12:16:42.460: E/AndroidRuntime(333): at java.lang.reflect.Method.invokeNative(Native Method)
06-05 12:16:42.460: E/AndroidRuntime(333):atjava.lang.reflect.Method.invoke(Method.java:507)
06-05 12:16:42.460: E/AndroidRuntime(333):atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-05 12:16:42.460: E/AndroidRuntime(333):atcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-05 12:16:42.460: E/AndroidRuntime(333): at dalvik.system.NativeStart.main(Native Method)