Share via


SmsMessage.CalculateLength Method

Definition

Overloads

CalculateLength(ICharSequence, Boolean)

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message.

CalculateLength(String, Boolean)

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message, given the current encoding.

CalculateLength(ICharSequence, Boolean)

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message.

[Android.Runtime.Register("calculateLength", "(Ljava/lang/CharSequence;Z)[I", "")]
public static int[]? CalculateLength (Java.Lang.ICharSequence? msgBody, bool use7bitOnly);
[<Android.Runtime.Register("calculateLength", "(Ljava/lang/CharSequence;Z)[I", "")>]
static member CalculateLength : Java.Lang.ICharSequence * bool -> int[]

Parameters

msgBody
ICharSequence

the message to encode

use7bitOnly
Boolean

if true, characters that are not part of the radio-specific 7-bit encoding are counted as single space chars. If false, and if the messageBody contains non-7-bit encodable characters, length is calculated using a 16-bit encoding.

Returns

Int32[]

an int[6] with int[0] being the number of SMS's required, int[1] the number of code units used, and int[2] is the number of code units remaining until the next message. int[3] is an indicator of the encoding code unit size (see the ENCODING_* definitions in SmsConstants). int[4] is the GSM national language table to use, or 0 for the default 7-bit alphabet. int[5] The GSM national language shift table to use, or 0 for the default 7-bit extension table.

Attributes

Remarks

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message.

Java documentation for android.telephony.SmsMessage.calculateLength(java.lang.CharSequence, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CalculateLength(String, Boolean)

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message, given the current encoding.

[Android.Runtime.Register("calculateLength", "(Ljava/lang/String;Z)[I", "")]
public static int[]? CalculateLength (string? messageBody, bool use7bitOnly);
[<Android.Runtime.Register("calculateLength", "(Ljava/lang/String;Z)[I", "")>]
static member CalculateLength : string * bool -> int[]

Parameters

messageBody
String

the message to encode

use7bitOnly
Boolean

if true, characters that are not part of the radio specific (GSM / CDMA) alphabet encoding are converted to as a single space characters. If false, a messageBody containing non-GSM or non-CDMA alphabet characters are encoded using 16-bit encoding.

Returns

Int32[]

an int[4] with int[0] being the number of SMS's required, int[1] the number of code units used, and int[2] is the number of code units remaining until the next message. int[3] is the encoding type that should be used for the message.

Attributes

Remarks

Calculates the number of SMS's required to encode the message body and the number of characters remaining until the next message, given the current encoding.

Java documentation for android.telephony.SmsMessage.calculateLength(java.lang.String, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to