Showing posts with label Gmail app. Show all posts
Showing posts with label Gmail app. Show all posts

How to Create an AlertDialog: Gmail: Send message

This example will create an AlertDialog similar to the Alert Dialog that displays on the Gmail app Version 2.3.6 (on API Level 10)
This was tested on a: Samsung YP-G0, API Level 10, Version 2.6.35



How to get to the AlertDialog we are reproducing:
Open Gmail app, Go to Inbox Select Menu, Compose
Type an email address to send a test email to(it could be your own email)
Press Send icon (without typing a subject, or a message), and the above AlertDialog will appear
To create the AlertDialog above, follow the steps below.

1. Set the Title in an AlertDialog to display with the message "Send message?".

2. Add an Icon/Drawable to the AlertDialog with the default Android Dialog Alert icon:  drawable: android.R.drawable.ic_dialog_alert

3. Set a the Message in an AlertDialog to "Send this message without text in the Subject?"

4. Set an AlertDialog.Builder Positive Button Listener with the display text of "OK"

5. Set an AlertDialog.Builder Negative Button Listener with the display text of "Cancel".

6. Compile and run!

How to Create an AlertDialog: Gmail: Long Press on Email

This example will create an AlertDialog similar to the Alert Dialog that displays on the Gmail app, Version 2.3.6
This was tested on a: Samsung YP-G0, API Level 10, Version 2.6.35

Long Press options

Long Press continued list of options



How to Get to the Alert Dialog we are creating
Open Gmail App
Select Inbox
Long Press an Email, and the above Alert Dialog will display.

1. To recreate this AlertDialog, Add a Title that displays "Your Email Subject Line Goes Here" * Note: This will actually be linked to the the Subject line of the email you selected, but for now we will add this static text.

2. Add a List of Items to an AlertDialog.Builder, with the CharSequence array of  "Read, Archive, Mute, Mark read, Delete, Add star, Change labels, Report spam, Help".

3. If the email has already been read, this CharSequence named myCharSequence2 should be displayed instead. "Read, Archive, Mute, Mark unread, Delete, Add star, Change labels, Report Spam, Help".

4. Compile and run!