为什么上的HTC Desire发送短信,当我得到NullPointerException异常,或者有什么SubmitPdu? [英] Why do I get NullPointerException when sending an SMS on an HTC Desire, or what is SubmitPdu?

查看:197
本文介绍了为什么上的HTC Desire发送短信,当我得到NullPointerException异常,或者有什么SubmitPdu?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我得到这个堆栈跟踪:

So I get this stack trace:

java.lang.NullPointerException    
   at android.telephony.SmsMessage$SubmitPdu.<init>(SmsMessage.java:132)
   at android.telephony.SmsMessage.getSubmitPdu(SmsMessage.java:551)
   at android.telephony.SmsManager.sendTextMessage(SmsManager.java:228)
   at android.telephony.SmsManager.sendTextMessage(SmsManager.java:107)
   at com.emergency.button.SMSSender.safeSendSMS(SMSSender.java:91)
   at com.emergency.button.EmergencyActivity$EmergencyThread
       .sendSMS(EmergencyActivity.java:294)
   at com.emergency.button.EmergencyActivity$EmergencyThread
       .sendMessages(EmergencyActivity.java:386)
   at com.emergency.button.EmergencyActivity$EmergencyThread
       .run(EmergencyActivity.java:266)

这是我如何打电话sendTextMessage,我不验证消息长度或电话号码的有效性:

And this is how I call sendTextMessage, I don't verify message length or phone number validity:

sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);

此错误似乎只发生在宏达欲望或HTC野火与Android版本2.2或2.21,所以我挖了Android平台的源代码(这实际上是不容易做到如我所料),并发现:
<一href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/SmsMessage.java;h=0617dada43e6119ab009cc917f11e1284ff09580;hb=5c1207be90fdf296c1b83034b7c68915e1749284"相对=nofollow> SmsMessage.java很久虽然这一次可能是不相关的,因为我看到的一些行号不用排队的。照片 该紧急按钮项目是开源的,所以你可以检查code OUT以供参考。我也许应该注意到,我不能对此进行测试我自己,我没有任何的手机型号。

This error seems to only occur on HTC Desire or HTC Wildfire with android version 2.2 or 2.21 so I dug up the android platform source (which is actually not as easy to do as I expected) and found:
SmsMessage.java once upon a time though this might not be relevant as I see some of the line numbers don't line up.
The emergency button project is open source so you can check the code out for reference. I should probably note that I can't test this myself, I don't have either phone model.

推荐答案

您可能会触及这个问题的消息太长。我不知道为什么它会只发生于某些手机,虽然。

You might be hitting this issue with a message that is too long. I don't know why it would only be happening for certain phones, though.

<一个href="http://$c$c.google.com/p/android/issues/detail?id=3718">http://$c$c.google.com/p/android/issues/detail?id=3718

这篇关于为什么上的HTC Desire发送短信,当我得到NullPointerException异常,或者有什么SubmitPdu?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆