Android Question Sms.PersonId always returns -1 : Is This Bug resolved ?

Slacker

Active Member
Licensed User
Longtime User
Hello Folks,
i suppose you know this issue and i've read elsewhere some workaround it about. My questions are aimed to show the possible best solutions to bypass this issue.

E.g. i've used the following code:

B4X:
Sub ShowSMSList
 
 
lst.Initialize(Me, svList, "", "lst_Click", "", 1dip)
 
Dim SmsMessages1 As SmsMessages
Dim List1 As List
Dim l2 As List
Dim cName As String
List1 = SmsMessages1.GetAll
 
 
Dim bodySMS As String = "Test Body"
 
For i = 0 To List1.Size - 1
    Dim Sms As Sms
    Sms = List1.Get(i)
   
    Try
    cName = contactTech.GetContactNamebyPhone(Sms.Address)
 
    Catch
        Log(LastException.Message)
    End Try
   
    If cName = "" Then
       
        lst.AddItem(Sms.id,False,Sms.Address, bodySMS)
    End If
Next
 
lst.ResizePanel
 
End Sub

This code is called when an Activity Starts; if this activity is paused and i start again it running the code above once again, a NullPointerException is raised on this line:

B4X:
cName = contactTech.GetContactNamebyPhone(Sms.Address)

StackTrace Tells:
java.lang.NullPointerException
at com.omnicorp.library.Technis.GetContactbyPhone(Technis.java:39)
at com.omnicorp.library.Technis.GetContactNamebyPhone(Technis.java:23)
.................................

This is pretty strange and i wonder if the developer or someone is aware about this issue.

Do you have any suggestions (Even to try another workaround to bypass the personid = -1 issue) ?

Thank you !
 

Slacker

Active Member
Licensed User
Longtime User
Erel, in my scenario (as that one of Others) PersonId has always -1 value. Regard to bug, just try to create an activity populating a "ClsCheckList" using Sub i showed above, and try to pause the Activity and start it back again. There will be raised the exception ( I THINK... ). It was raised the same testing the code on 2 different devices.

Another question: What could it be the cause to getting all SMS.PersonId values equal to -1 ? In other threads it was called as Bug...
 
Upvote 0
Top