What is wrong

volvomann

Active Member
Licensed User
Longtime User
Hallo i tried to read out this file into a label, there is 6 lins saved with writline
I got this error ( java.lang.nullpointer expection)


Code: Copy
sub smsbmi 

Dim textreader1 As TextReader


     textreader1.Initialize(File.OpenInput(File.DirRootExternal &"/pulsdata/mail", "Helge.doc"))
    Dim linje As String
    linje = textreader1.ReadLine    
    Do While linje <> Null
         linje = textreader1.ReadLine
       Lab.Text=linje
         Loop
    
    textreader1.Close

        
     
End Sub
 
That's logical, since you are overwriting the value on every iteration.
Try changing to this:


Code: Copy
 linje = textreader1.ReadLine    
Do While linje <> Null
          linje = linje & crlf & textreader1.ReadLine
Loop
     Lab.Text=linje

Apparently our posts crossed...
 
Last edited:
Upvote 0
Is i posible to get all 6 lines from lab.text to be sendt on sms

like i do whith one line xxxx.text (SendSms("xxxxxxxxx",Lab.text)

When i tried this i got the same error ( java.lang.nullpointer expection)
 
Upvote 0
Yes. Run your program in debug mode to find the source of this error.

It is here it works whith one line in the lab.text. i use it somwhere else in this app and i another apps:
is there a limit for how mutch text i can putt in sthe string?
Code: Copy
r.RunMethod4("sendTextMessage", Array As Object(PhoneNumber, Null, Text, Null, Null),

Code: Copy
Sub SendSms(PhoneNumber As String, Text As String)
    Dim ps As PhoneSms
    Dim r As Reflector
    r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
    r.RunMethod4("sendTextMessage", Array As Object(PhoneNumber, Null, Text, Null, Null), _
     Array As String("java.lang.String", "java.lang.String", "java.lang.String", _
     "android.app.PendingIntent", "android.app.PendingIntent"))
End Sub
 
Last edited:
Upvote 0
View attachment log.txt

Here is the log I thing it is the lengt off the text that cause the problem when remove som lins in the file it is ok. How can I get the text to been sendt in to sms like i do on the phone And likly camtrue like one sms?
 
Last edited:
Upvote 0
No Iàm sure that it is the 160 chr limit that cause the problem, but i cant figure out how to fix the problem:
 
Upvote 0
Back
Top