Android Question Send mail database

Tata Mapassa

Member
Licensed User
Longtime User
below is the code I use to retrieve the emails but using the list as the recipient of the email crashes

Dim ListMail As List
ListMail.Initialize
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT Mail FROM Table")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
ListMail.Add(Cursor.GetString("Mail"))
Next
Cursor.Close
SQL1.Close

Try
Dim email As Email
email.To.AddAll(Array As String(ListMail))
email.Subject = ""
email.body =""
Dim in As Intent = email.GetIntent
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
StartActivity(in)
Catch
Log(LastException)
End Try
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Please use [code]code here...[/code] tags when posting code.
B4X:
'email.To.AddAll(Array As String(ListMail))
'The parameter just is list not need to convert it to Array
email.To.AddAll(ListMail)
 
Upvote 0
Top