Intercepting texts

RilleR

Member
Licensed User
Longtime User
Im working with my SMS application and now have a service running that wakes up the activity when new messages arrive from one user. It works, opens the main activity and show the message in a label.

Now i try the next step..cleaning the message from technical information and separating each word in different rows to be able to count words to get an streetadress from the textmessage.

I have tried Regex and Match, but cant get it to work..
I get [Ljava.lang.String;@40585cb8

I probably miss many steps...but i try to take one step at a time and now stuck at this :BangHead:

Here is the Activity:

B4X:
Sub RefreshData
   
   Dim SmsMessages1 As SmsMessages 
Dim List1 As List

List1 = SmsMessages1.GetAllSince(DateTime.Add(DateTime.Now , 0, 0, -5))
For i = 0 To List1.Size - 1
Dim Sms As Sms
Sms = List1.Get(i)
If Sms.Address = "+41234567" Then 
Log(Sms)
End If
Next 

    Dim text As String
    text= (List1)
    Dim tempstr() As String
    tempstr = Regex.Split("(\b[^\s]+\b)", List1)
   
    Log(tempstr)
   lblPos.text  = (tempstr)


I have also tried Erel's example but get the same error..

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Dim text As String
    text= "Please send issues to [email][email protected][/email], putting them in the reviews doesn't help me find/fix them".touppercase
    Dim tempstr() As String
    tempstr = Regex.Split("\s", text)
End Sub
 
Last edited:

Penko

Active Member
Licensed User
Longtime User
You are trying to log a complex object(resource). You get the java memory address(sorry for the lame explanation, I don't really now what's that called).

That's not an error but obviously you are not using the data correctly. I am not much into your code, just check Log(Sms). That's not possible to be logged according to my opinion. Isn't there any .Message() method or anything else that gives you the actual message text back?

Remember, getting values like this in the logs is pretty normal. It just have to make you check the object for particular parse methods because it's not useful to you like this.

I think you understood nothing from my dummy explanation, it's 00:49 here...
 
Upvote 0

RilleR

Member
Licensed User
Longtime User
Thankyou for your reply Penko,

Well if i use

B4X:
lblPos.text  = (Sms)
Or
B4X:
lblPos.text  = (List1)

It works and i get parts of my textmessage in the label

But using
B4X:
lblPos.text  = (Tempstr)
Give me the Java error, so i think that means i have the error in the Regex part of the code.







You are trying to log a complex object(resource). You get the java memory address(sorry for the lame explanation, I don't really now what's that called).

That's not an error but obviously you are not using the data correctly. I am not much into your code, just check Log(Sms). That's not possible to be logged according to my opinion. Isn't there any .Message() method or anything else that gives you the actual message text back?

Remember, getting values like this in the logs is pretty normal. It just have to make you check the object for particular parse methods because it's not useful to you like this.

I think you understood nothing from my dummy explanation, it's 00:49 here...
 
Last edited:
Upvote 0
Top