EMail when I tap the note field.

CD Tom

Member
Licensed User
Longtime User
Hi, my apps been working fine but a question came up and being new to this apps stuff I need to ask the experts.
In my app I have a note field. I have a button the says add notes. when tapped brings up a note field where user can type in what ever they want. Now the question came up can I email that note to somebody.
In my thinking, would there be a way that the user could tap the note field and that would then start an email going.
I've been looking at all the email posts and there are lots. Can someone point me to a good example of the code needed to send an email? When you start an email does it allow you to enter the email recipient and the subject?
Again any help is greatly appreciated.
 

Mahares

Expert
Licensed User
Longtime User
Here is one way of doing it as your post requests:
B4X:
Dim txtNote As EditText
Sub txtNote_LongClick   'It is the long click because the single click inserts data.
     'assuming a text box txtNote is holding the note 
     Dim MyEmail As Email  'need phone lib
     Dim MyAddress As String   'Input each time. Better if stored somewhere
     Dim ret As Int
      Dim inputText As InputDialog   'need dialogs lib   
      ret=inputText.Show("Please enter email address","Email","OK","","",Null)
      If ret=-1 Then
         MyAddress=inputText.Input 
      End If      
      MyEmail.To.Add(MyAddress)  'You can validate address
      MyEmail.Subject="This is the new note."      
      MyEmail.Body=txtNote.text   'this is the email body stored in the text box
      StartActivity(MyEmail.GetIntent)
End Sub
 
Last edited:
Upvote 0
Top