Gaurav Gupta
Gaurav Gupta

Reputation: 575

sendTextMessage gives nullpointerexception while sending more than one sms in android

HI I am trying to send sms in android 1.5 by breaking it in multiple parts as the message text exceeds 160 characters but the problem is that only first part of the sms is forwared. i.e. remaining messages are not sent and NullPointerException is generated.

for eg

original sms is "gaurav is a good boy"

SMS 1 : gaurav SMS 2 : is a SMS 3 : good boy

These sms are lying in a String array named smsArray[] i am sending these these sms in a loop by calling sendTextMessage

'for(int i=0;i<3;i++) {

sendTextMessage("9815798751",null , smsArray[i],null,null);

}'

I have even tried to use sendMultiPartTextMessage() but that does not help either.

Please Help

Upvotes: 0

Views: 783

Answers (1)

Gaurav Gupta
Gaurav Gupta

Reputation: 575

HI I found the solution for the above question.. Android 1.5 lets u send message with length of 68 chars.. if you are sending multi part message. so If you have to send multiple messages then keep the length of all ur messages 68 chars..

Regards Gaurav Gupta

Upvotes: 1

Related Questions