Android Question getSize or size ?

bokinet

Member
Licensed User
I found bellow post for sending sms message.
I part which Erel suggested when using bellow line (original from his post) I'm getting error that getSize not exists.
Dim size As Int = parts.RunMethod("getSize", Null)

But when I replace getSize with size then everything works okay
Dim size As Int = parts.RunMethod("size", Null)

Question is:
Should be getSize or size?

B4X:
Sub SendLargeSms(Destination As String, Message As String)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim smsManager As JavaObject
    smsManager = smsManager.InitializeStatic("android.telephony.SmsManager").RunMethod("getDefault", Null)
    Dim parts As JavaObject = smsManager.RunMethod("divideMessage", Array(Message))
    Dim i As Intent
    i.Initialize("b4a.smssent", "")
    Dim pi As JavaObject
    pi = pi.InitializeStatic("android.app.PendingIntent").RunMethod("getBroadcast", Array(ctxt, 0, i, 134217728))
    'Dim size As Int = parts.RunMethod("getSize", Null)
    Dim size As Int = parts.RunMethod("size", Null)
    Dim al As JavaObject
    al.InitializeNewInstance("java.util.ArrayList", Null)
    For ii = 0 To size - 2
        al.RunMethod("add", Array(Null))
    Next
    al.RunMethod("add", Array(pi))
    smsManager.RunMethod("sendMultipartTextMessage", Array(Destination, Null, parts, al, Null))
End Sub

Old post location
https://www.b4x.com/android/forum/threads/multipart-sms-sent-status.74903/#content
 
Top